Skip to content
Prev 14153 / 398503 Next

Weird feature when creating function lists with apply

Hi R-fellows,

can anyone explain this weird feature? I am trying to create a list of
functions with apply, and it appears that there is something strange going
on when the function evaluates the argument a. When I duplicate a into a
local variable b, the result changes !?!

Any pointers? Thank in advance. Cheers,

Uffe


# Create a function which returns a function
# Create a list of functions, parameterised by 1:4
[1] 4

# Repeat
[1] 2

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Uffe H. Thygesen, M.Sc.&Eng., Ph.D.
Danish Institute of Fisheries Research
http://www.dfu.min.dk


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._