[R] Is this a bug or am I making a mistake?

Sarah Goslee sarah.goslee at gmail.com
Mon Jan 6 18:14:20 CET 2014

Hi Walter,

I can't reproduce your results. Please provide some data that
demonstrates the problem.


subset() and [ differ in their handling of NA values, and you don't
need the dd$ in the arguments to subset().

But those don't explain your result given the information provided.
Please provide more information.


On Mon, Jan 6, 2014 at 12:06 PM, Walter Anderson <wandrson01 at gmail.com> wrote:
> I have a data frame that I am extracting some records from and noticed the
> following issue
> I originally used tmp <- subset(dd, dd$EVYEAR==2012 & dd$EVMONTH=='02')
> and noticed that I wasn't ending up with all of the records I should have;
> however, when I used
> tmp <- dd[dd$EVYEAR==2012 & dd$EVMONTH=='02',]
> I did get all of the records I should have.
> I thought the two forms were equivalent, am I mistaken?

Sarah Goslee

More information about the R-help mailing list