[R] Working with lists

William Vedder wvedder at houston.rr.com
Sat Jul 27 08:56:54 CEST 2002

Greetings All,

I'm stuck and would appreciate some help.

After writing a function to generate a random sample from vector
> f<-function(i) {y<-sample(rand1,296,replace=F)}

and using the function to generate multiple samples from rand1 and store
the results in list "l":
> l<-lapply(1:100,f)

I can't get the next step accomplished; I'd like to sort each of the
generated samples.  I've tried:
> sort(l)

but get the msg:
Error in sort(l) : `x' must be atomic

I've tried numerous other approaches (converting l to a dataframe and
trying to work with it, eg) with no success.

I've the documentation on lists and dataframes and vectors, etc but
still must not be understanding these correctly.  Can someone give me a
clue as to how to proceed...



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

More information about the R-help mailing list