[R] How to use a for loop to generate two sequences

Thomas Lumley tlumley at u.washington.edu
Thu Jun 29 21:51:18 CEST 2006


On Thu, 29 Jun 2006, Xiaohua Dai wrote:

> Hi R users,
>
> Hope the question is not too simple:
>
> How to use a for loop to generate two lists as below:
>
> testlist <- list(test1, test2, ..., test1000)
> stringlist <- list("test1","test2",...,"test1000")

I don't know why you would want to use a for loop:

  stringlist<-as.list(paste("test",1:1000,sep=""))
  testlist<-lapply(stringlist, as.name)


 	-thomas



More information about the R-help mailing list