[Rd] Errors in demo (PR#10527)

Duncan Murdoch murdoch at stats.uwo.ca
Mon Dec 24 12:20:28 CET 2007


On 24/12/2007 1:00 AM, rcwright at texas.net wrote:
> Full_Name: richard wright
> Version: R version 2.6.1 (2007-11-26)
> OS: Mac OS X v 10.4.11
> Submission from: (NULL) (76.240.79.123)
> 
> 
> I downloaded the most recent version of  R for the mac (About: GUI 1.22-devel
> (4859) (4859)) and installed it.
> After installation, I opened the help file and ran the demo. I am new to R,
> although I have over 25 years experience in SAS.
> 
> Below is a part of the job I ran. I think I ran the code correctly, but I seem
> to be blowing off.
> And, I'm not sure it's related, but I also included what I got when I ran
> bug.report()
> 
>> dummy <- data.frame(x=x, y =x+rnorm(x)*w)
>> dummy
>     x         y
> 1   1  1.425904
> 2   2 -1.083024
> 3   3 -1.976215
> 4   4  4.185795
> 5   5  8.598591
> 6   6  1.004177
> 7   7  5.357826
> 8   8  9.033184
> 9   9  6.455373
> 10 10  8.166066
> 11 11 12.383454
> 12 12 10.823910
> 13 13 14.410394
> 14 14 13.046184
> 15 15 15.912303
> 16 16 13.454527
> 17 17 15.827133
> 18 18 18.586979
> 19 19 10.845216
> 20 20 20.935347
>> fm <-lm(y-x,data=dummy)
> Error in switch(mode(x), "NULL" = structure(NULL, class = "formula"),  : 
>   invalid formula

This looks like your error, rather than a bug in R.  The formula should 
be "y ~ x" (y tilde x), not "y - x".

> In addition: Warning message:
> In y - x : longer object length is not a multiple of shorter object length

This warning is also a consequence of the typo, in a roundabout way.  It 
is saying that x and y are different lengths, which is clearly not true 
for the columns of dummy:  but because you just subtracted them, it took 
x and y to be variables in their own right, not columns.  Presumably the 
objects listed below are different lengths.

>> ls()
> [1] "dummy" "w"     "x"     "y"    
>> bug.report()
> Error in bug.report() : 'subject' missing

Please check on R-help or R-devel first, until you're sure something is 
a bug.  It takes a bit of effort to deal with a bug report regardless of 
whether it is real or not.

Duncan Murdoch



More information about the R-devel mailing list