On Aug 13, 2010, at 4:06 PM, fishkbob wrote:


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

Although which() is useful when used with "[" because it avoids the NA indexing problem, it is entirely superfluous here.

 blah<- blah[-is.na(blah) ]   # will be more efficient



--

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org 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.

Reply via email to