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

2014-01-12 Thread Patrick Connolly
On Mon, 06-Jan-2014 at 07:38PM +, William Dunlap wrote: | You could compare the outputs of | z1 - with(dd, dd$EVYEAR==2012 dd$EVMONTH=='02') Wouldn't with(dd, EVYEAR==2012 EVMONTH=='02') be sufficient when using with()? | (which is like subset()) and that of | z2 -

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

2014-01-12 Thread William Dunlap
Wouldn't with(dd, EVYEAR==2012 EVMONTH=='02') be sufficient when using with()? It probably would be sufficient to get the right answer, but I thought the OP was wondering why there was a difference. Comparing the results of his original code with new code would help uncover the reason. Bill

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

2014-01-12 Thread David Winsemius
On Jan 6, 2014, at 11:16 AM, Walter Anderson wrote: On 01/06/2014 11:14 AM, Sarah Goslee wrote: Hi Walter, I can't reproduce your results. Please provide some data that demonstrates the problem. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

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

2014-01-06 Thread Walter Anderson
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

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

2014-01-06 Thread Sarah Goslee
Hi Walter, I can't reproduce your results. Please provide some data that demonstrates the problem. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example subset() and [ differ in their handling of NA values, and you don't need the dd$ in the arguments to subset().

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

2014-01-06 Thread Walter Anderson
On 01/06/2014 11:14 AM, Sarah Goslee wrote: Hi Walter, I can't reproduce your results. Please provide some data that demonstrates the problem. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example subset() and [ differ in their handling of NA values, and you

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

2014-01-06 Thread William Dunlap
You could compare the outputs of z1 - with(dd, dd$EVYEAR==2012 dd$EVMONTH=='02') (which is like subset()) and that of z2 - dd$EVYEAR==2012 dd$EVMONTH=='02' (evaluated from within the same context) with table(z1, z2, exclude=NULL) That may show something useful. Bill Dunlap