Perez Martin, Agustin <agustin.perez <at> umh.es> writes:
: I have a list with 500 elements, in each other there are data.frames and I : want to take the first row and the first column of each elements of my list : since the first to the 500-th. Here are some variations depending on what you want. Also try all these with lapply replaced by sapply. # test data data(iris) iris <- head(iris) L <- list(iris, iris) # various possibilities lapply(L, "[", 1, 1) # column 1, row 1 lapply(L, "[[", 1) # column 1 lapply(L, "[", 1) # column 1 as data frame lapply(L, function(x) x[1,]) # row 1 lapply(L, function(x) list(x[1,],x[,1])) # 2 el list with row 1 and column 1 ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
