Message-ID: <EF859EEF-723A-432B-8A03-F2E1D597A90E@comcast.net>
Date: 2011-04-28T21:02:40Z
From: David Winsemius
Subject: subset without removing NAs
In-Reply-To: <BANLkTimCO8nO7VqErmB0BVcysV5=zOFyxQ@mail.gmail.com>
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 addition to anything
> <50.
> Any suggestions much appreciated.
If you use "[" instead the NA's will come though:
rw.fire.RW[ shigo.av<50, ]
In fact I generally wrap my logicals in which to avoid such
(mis?)behavior. but you appear to approve of it.
==
David Winsemius, MD
West Hartford, CT