Re: [R] Selections in lists

2011-09-01 Thread mdvaan
Thanks David and Jorge for your comments! -- View this message in context: http://r.789695.n4.nabble.com/Selections-in-lists-tp3768562p3784816.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://st

Re: [R] Selections in lists

2011-08-25 Thread Jorge I Velez
Hi mdvaan, Not the best solution, but it should get you started: lapply(g, function(l){ n <- names(l) res <- lapply(1:length(n), function(ii){ rr <- l[[n[ii]]] rn <- rownames(rr) cn <- colnames(rr) i <- rn %in% n[[ii]] rr

Re: [R] Selections in lists

2011-08-25 Thread David Winsemius
On Aug 25, 2011, at 11:24 AM, mdvaan wrote: Hi, I have produced a list g and I would like to reduce the amount of information contained in each object in g. For each matrix I would like to keep the values where the column name equals g[year][[1]][[x]] and the row names equals g[year][[1]][[

[R] Selections in lists

2011-08-25 Thread mdvaan
Hi, I have produced a list g and I would like to reduce the amount of information contained in each object in g. For each matrix I would like to keep the values where the column name equals g[year][[1]][[x]] and the row names equals g[year][[1]][[-x]]. So in g$`1999`$`8029`, year = 1999 and x = 8