[R] Re ading Functions that are in a Vector

trumpetsaz stephaniezimmer at gmail.com
Mon Sep 28 04:36:16 CEST 2009


I am trying to write a function that will have an input of a vector of
functions. Here is a simplistic example.
sumstats <- c(mean,sd)
sumstats[1]
#Gives this error
#> sumstats[1]
#[[1]]
#function (x, ...) 
#UseMethod("mean")
#<environment: namespace:base>

I thought about restricting the input to character variables such as the
following
sumstats2 <- c("mean","sd")
Is there a way to change "mean" to the function mean?
-- 
View this message in context: http://www.nabble.com/Reading-Functions-that-are-in-a-Vector-tp25639720p25639720.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list