[R] bug or feature?

From: ivo welch <ivowel_at_gmail.com>
Date: Thu, 17 May 2007 13:15:14 -0400


R version 2.5.0, under gentoo linux. This may be just my ignorance about naming conventions inside loops and subsets, but the following appears like a bug to me.

y = c( 1963, 1963, 1964, 1964, 1965, 1965 ); r1= rnorm(6);
d= data.frame ( y=y, r1=r1 );

## note: I am not attach()ing anything anywhere

## this should give me two results, which it does
ahw.y= subset(d, d$y==1963); print(summary(ahw.y));

## this should give me the same two results, which it does not. All 6
are included now.
for (y in 1963:1963) {
  subd= subset(d, d$y==y);
  print(summary(subd));
}

## this should give me the same two results, which it does
for (yr in 1963:1963) {
  subd= subset(d, d$y==yr);
  print(summary(subd));
}

hope this helps. (if its a bother, please let me know and I won't post such emails anymore. would save me time, too.)

regards,

/ivo



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 17 May 2007 - 17:18:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 May 2007 - 18:31:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.