Skip to content
Prev 172523 / 398503 Next

Odp: Filtering R lists

Hi


r-help-bounces at r-project.org napsal dne 04.03.2009 13:18:30:
Lists can have quite complicated structure so here is only a small 
suggestion

lapply(your.list, function(x) x==desired.value)

This shall give you list of logical values if your list has only one 
level. 

Something like

pts <- list(x=mtcars[,1], y=mtcars[,2], z=mtcars[,10])
pts[which(unlist(lapply(pts, function(x) sum(x==4)>0)))]

Regards
Petr
inSymbol, type
inSymbol, type
inSymbol, type
inSymbol, type
inSymbol, type
http://www.R-project.org/posting-guide.html