[Rd] all.equal applied to function closures

2020-11-30 Thread Kevin Van Horn via R-devel
Consider the following code: f <- function(x)function(y){x+y} all.equal(f(5), f(0)) This returns TRUE, when it should return FALSE; I think it’s hard to make the case that f(5) and f(0) are “approximately equal” in any meaningful sense. Digging into the code for all.equal(), I see that

Re: [Rd] all.equal applied to function closures

2020-11-30 Thread Duncan Murdoch
On 30/11/2020 1:05 p.m., Kevin Van Horn via R-devel wrote: Consider the following code: f <- function(x)function(y){x+y} all.equal(f(5), f(0)) This returns TRUE, when it should return FALSE; I think it’s hard to make the case that f(5) and f(0) are “approximately equal” in any meanin

[Rd] undocumented 'offset' argument in src/library/grDevices/man/adjustcolor.Rd

2020-11-30 Thread Ben Bolker
The 'offset' argument description is blank ... maybe 'additive adjustment to each of the (red, green, blue, alpha) values defining the colors, after adjustment by the corresponding \code{.f} factor' ...? This is the relevant code: x <- col2rgb(col, alpha = TRUE)/255 x[] <- pmax(0, p

Re: [Rd] all.equal applied to function closures

2020-11-30 Thread Bill Dunlap
To make the comparison more complete, all.equal.environment could compare the parents of the target and current environments. That would have to be recursive but could stop at the first 'top level environment' (the global, empty, or a package-related environment generally) and use identical there.