[R] Lists and functions in data.frame?

2010-12-08 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I would like to have a data.frame, where one column contains functions, and another one lists. i.e.: FUN - function(l) {return(l$a+l$b+l$c} LIST - list(a=1, b=2, c=3) d - data.frame(fun=FUN, no=LIST, value=2, b=TRUE) FUN - function(l)

Re: [R] Lists and functions in data.frame?

2010-12-08 Thread jim holtman
It sounds like you want to use a list instead of a dataframe, especially if the elements are a different length. d - list() # initialize d[[length(d) + 1]] - list() # extend d[[length(d)]]$fun - sin # add a function d[[length(d) + 1]] - list() # extend again d[[length(d)]]$fun - cos #

Re: [R] Lists and functions in data.frame?

2010-12-08 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/08/2010 11:22 AM, jim holtman wrote: It sounds like you want to use a list instead of a dataframe, No - I would like to have a data,frame. I am aware of the differences, but as far as I understand, each column in a data.frame can have a