Dear all, it is likely a stupid question but I cannot solve it.
I want to have a matrix of 100 elements. Each element must be a vector of 500 elements. If I do: imp<-array(dim=100) imp[1]<-vector(length=500) it does not work. Warning message: "number of items to replace is not a multiple of replacement length" If I do: imp <- array(dim=c(100,500)) and then fill imp: for(i in c(1:500)) { imp[i,] <- im[1:500,] #im[1:500,] is a vector of length 500, of class numeric. IT CONTAINS NAMES! } Now it works, but I loose the labels (names) associated to the original "im" variable. If I just do: j<- im[1:500,] I do not loose the labels. names(j) => list of labels names(imp[1,]) => NULL Any clue? Thanks in advance! Federico ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.