[R] Naming Lists

Tom.O tom.olsson at dnbnor.com
Tue Aug 7 13:42:40 CEST 2007


Hi
Im pretty new to R and I have run in to a problem. How do I name all the
levels in this list.

Lev1 <- c("A1","A2")
Lev2 <- c("B1","B2")
Lev3 <- c("C1","C2")

MyList <- lapply(Lev1,function(x){
lapply(Lev2,function(y){
lapply(Lev3,function(z){
paste(unlist(x),unlist(y),unlist(z))
})})})

I would like to name the different levels in the list with the differnt
inputs.
So that the first level in named by the inputs in Lev1 and the second Level
by the inputs in Lev2, and so on

I would then like to use this call

MyList$A1$B1$C1
> "A1 B1 C1"

Regards Tom
-- 
View this message in context: http://www.nabble.com/Naming-Lists-tf4228968.html#a12030717
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list