Skip to content
Prev 79671 / 398502 Next

creating a matrix of "objects"

Dear R,

I??m really new to R, so it could be that my 
question is one of those "read the manual" ones.
But I did that and found nothing.

Problem: I need to get a "matrix" of "datapoints".
         Each datapoint has to contain tree attributes.

trials like:


make.LDmatrix <- function(nrbases){

b1 <- list(sum=NA, sqrsum=NA, hits=NA)
result <- list()

for(i in seq(1,nrbases)){
	for(j in seq(1,nrbases)){
		result[[i]][[j]] <- b1
}}
result
}



did not work because of a "out of bound" error.

It would be very kind if someone could help me with this.

Thanks, Andy