[R] how to eliminate an element of a list

fishkbob fishkbob at gmail.com
Fri Aug 13 22:06:16 CEST 2010


> list<-seq(2,10,2)
> list
[1]  2  4  6  8 10
> list[-which(2==list)]
[1]  4  6  8 10

using the which() will let you remove things from a list that have a
specified value... I usually use the 

blah<- blah[-which(TRUE==is.na(blah)) ]

which will remove all NA values in your list
-- 
View this message in context: http://r.789695.n4.nabble.com/how-to-eliminate-an-element-of-a-list-tp2323329p2324696.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list