[R] elegant way of removing NA's and selecting specific values from a data.frame

Jim Maas j.maas at uea.ac.uk
Wed Jul 6 17:35:02 CEST 2011


I have a data.frame "e" and would like to extract the 23rd column, 
remove any NA's and then remove any values >= 30.  I can do it in steps 
such as this but have failed to figure out how to do it in a single line 
.... any suggestions?

first <- e[,23]
second <- first[!is.na(first)]
third <- second[second<=30]

thanks a bunch

J

-- 
Dr. Jim Maas
University of East Anglia



More information about the R-help mailing list