Re: [R] Re ading Functions that are in a Vector

2009-09-28 Thread baptiste auguie
Also, have a look at each() in the plyr package, library(plyr) each(length, mean, var)(rnorm(100)) baptiste 2009/9/28 trumpetsaz : > > 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] > #Give

Re: [R] Re ading Functions that are in a Vector

2009-09-28 Thread baptiste auguie
Hi, You said, >sumstats <- c(mean,sd) >sumstats[1] >#Gives this error but this is not an error! You created a list that contains two functions, and sumstats[1] simply prints the first one. HTH, baptiste __ R-help@r-project.org mailing list https://s

Re: [R] Re ading Functions that are in a Vector

2009-09-27 Thread Rolf Turner
On 28/09/2009, at 4:30 PM, David Winsemius wrote: On Sep 27, 2009, at 11:07 PM, Rolf Turner wrote: On 28/09/2009, at 3:36 PM, trumpetsaz wrote: 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[

Re: [R] Re ading Functions that are in a Vector

2009-09-27 Thread David Winsemius
On Sep 27, 2009, at 11:07 PM, Rolf Turner wrote: On 28/09/2009, at 3:36 PM, trumpetsaz wrote: 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]] #functi

Re: [R] Re ading Functions that are in a Vector

2009-09-27 Thread Rolf Turner
On 28/09/2009, at 3:36 PM, trumpetsaz wrote: 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") # I thought about restr

Re: [R] Re ading Functions that are in a Vector

2009-09-27 Thread Gabor Grothendieck
On Sun, Sep 27, 2009 at 10:36 PM, trumpetsaz wrote: > > 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") >

[R] Re ading Functions that are in a Vector

2009-09-27 Thread trumpetsaz
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") # I thought about restricting the input to character variables such as