[R] Environmental oddity --- reproducible example.

Berwin A Turlach berw|n@tur|@ch @end|ng |rom gm@||@com
Sun Nov 7 09:22:38 CET 2021


G'day Rolf,

On Sun, 7 Nov 2021 19:33:40 +1300
Rolf Turner <r.turner using auckland.ac.nz> wrote:

> library(Deriv)
> d1 <- Deriv(dnorm,"sd")
> source("d2.txt") # d2.txt is attached
> 
> d1(1,0,3,TRUE) # [1] -0.2962963
> d2(1,0,3,TRUE) # [1] -0.8888889

Fascinating:

R> pryr::call_tree(body(d1))
R> pryr::call_tree(body(d2))

clearly show that the two functions have a different idea to what
expression the final "/sd" is applied too (as an earlier poster
suggested), but I have no idea why.

Deriv() seems to return the correct function, but when it is displayed,
the deparser(?) somehow omits a crucial pair of braces.

Cheers,

	Berwin



More information about the R-help mailing list