Hi there, 

I cannot seem to figure out how to access the elements of a list if those 
elements are a matrix.
For example I have a the following list
 
df.list <- vector("list", 3)
and I have made each of the elements a matrix as follows

for(i in 1:3){
 assign(paste("s",i, sep=""),matrix(0, nrow = 20, ncol = 5, byrow
= FALSE, dimnames = NULL))
}

# and then insert them with a loop like this

# put matrices names in a vector
matrices<-c("s1","s2","s3") 

# insert
for(i in 1:3){
df.list[[i]] <- matrices[i]
}

My question is I cannot access the first rwo of the matrix within a list. The 
following does not work

df.list [[1]][1,]

Thanks for your help!

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to