[R] Strange behaviour of R?
Sigbert Klinke
@|gbert @end|ng |rom w|w|@hu-ber||n@de
Fri Jan 17 08:33:37 CET 2020
Hi,
I wrote a function like
test <- function(FUN, args) {
print(FUN)
FUN(args)
}
When I call it lieke this
test(mean, 1:10)
test(NULL, 1:10)
then the second call still uses mean, although I set FUN to NULL. Is
that ok?
Actually, I used something like
test(mean, list(x=1:10, na.rm=TRUE))
which actually crashed R, but I can not reproduce it. Of course, when I
replaced FUN(args) with do.call(FUN, args) then everything works fine.
Sigbert
--
https://hu.berlin/sk
https://hu.berlin/mmstat3
More information about the R-help
mailing list