Re: [R] subset without removing NAs

2011-04-28 Thread Benjamin Caldwell
Thanks, that worked. *Ben Caldwell* On Thu, Apr 28, 2011 at 2:02 PM, David Winsemius wrote: > > On Apr 28, 2011, at 3:53 PM, Benjamin Caldwell wrote: > > Hi folks, >> >> I'm dealing with a dataset with a lot of NAs, and want to use subset on >> the >> data without removing the NAs from the th

Re: [R] subset without removing NAs

2011-04-28 Thread David Winsemius
On Apr 28, 2011, at 3:53 PM, Benjamin Caldwell wrote: Hi folks, I'm dealing with a dataset with a lot of NAs, and want to use subset on the data without removing the NAs from the the dataframe; e.g. rws50 <- subset(rw.fire.RW,shigo.av<50) This removes instances with NA for the value in ad

Re: [R] subset without removing NAs

2011-04-28 Thread Marc Schwartz
On Apr 28, 2011, at 3:21 PM, Jannis wrote: > On 04/28/2011 09:53 PM, Benjamin Caldwell wrote: >> rws50<- subset(rw.fire.RW,shigo.av<50) > > quick and dirty would be to replace all NAs with -9 (or similar), use > subset, and set all values ==-9 in the subset back to NA. There may be > mo

Re: [R] subset without removing NAs

2011-04-28 Thread Jannis
On 04/28/2011 09:53 PM, Benjamin Caldwell wrote: rws50<- subset(rw.fire.RW,shigo.av<50) quick and dirty would be to replace all NAs with -9 (or similar), use subset, and set all values ==-9 in the subset back to NA. There may be more elegant solutions, though. Jannis _

[R] subset without removing NAs

2011-04-28 Thread Benjamin Caldwell
Hi folks, I'm dealing with a dataset with a lot of NAs, and want to use subset on the data without removing the NAs from the the dataframe; e.g. rws50 <- subset(rw.fire.RW,shigo.av<50) This removes instances with NA for the value in addition to anything <50. Any suggestions much appreciated. *B