Re: [R] dynamic lists (data frames?)

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Wed 28 Sep 2005 - 05:04:40 EST

When sapply is used on a character vector it will use those as the names so:

data <- sapply(as.character(1:5), function(x) seq(as.numeric(x),10))

will give data with the required names.

On 9/27/05, tom wright <tom@maladmin.com> wrote:
> Can someone please show me what I need to get something like this to
> work
>
> for(a in c(1:5)){
> data$a<-c(a:10)
> }
>
> so that i end up with a structure
> data$1<-[1,2,3,4,5,6,7,8,9,10]
> data$2<-[2,3,4,5,67,8,9,10]
> data$3<-[3,4,5,67,8,9,10]
> data$4<-[4,5,67,8,9,10]
> data$5<-[5,67,8,9,10]
>
> thanks loads
> Tom
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Sep 28 05:14:09 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:49:56 EST