[R] Removing object - searching/googlin' ..and more hasn't helped :(

Ben Bolker bbolker at gmail.com
Fri Mar 25 14:33:53 CET 2011


agustgisla <agg26 <at> hi.is> writes:

> 
> I know this is probably really easy thing but...
> I've loaded data into R from the net. I've got 97 subjects (in a database).
> I'm supposed to remove subjects "lower than 140 cm".. Of course it's easy to
> find the subject (i.e. number 83 and 84) - but how can I delete these
> subjects from the database in R? (delete the entire row..)?
> I've spent 2 hours searching the net now.. And my laptop is lucky to still
> be on the table, but nut out in the snow!
> Thanks for reading, every suggestion is appreciated!

  You should start by reading the "Introduction to R" that comes
with R, which explains how to do this sort of indexing.

  If your data set is 'd' and the name of the size variable is 'size',

d2 <- subset(d,size>140)

 will work (this doesn't modify the original data set: but if you
want you can assign the new version to the original variable, writing over
it:  d <- subset(d,size>140)



More information about the R-help mailing list