[R] Error in plot.lm

From: Jeff Newmiller <jdnewmil_at_dcn.davis.ca.us>
Date: Fri, 11 Mar 2011 11:06:28 -0800 (PST)

I am encountering an error with plot.lm:

> tstdf <- data.frame( y=c(1.01,1.98,3.02,3.99),x=c(1,2,3,4)) > plot(lm(I(y) ~ x, data=tstdf))

Hit <Return> to see next plot:
Hit <Return> to see next plot:
Error in object$coefficients : $ operator is invalid for atomic vectors

Obviously I don't need the I() in this example, but I have been working with regressions that involve an expression on the left side of the formula, for which I do need the I(). I can work around by declaring a new actual column with the computed result, but this seems otherwise unnecessary.

Is this behaviour intended?

> R.Version()
[1] "i386-pc-mingw32"

[1] "i386"

[1] "mingw32"

[1] "i386, mingw32"

[1] ""

[1] "2"

[1] "12.1"

[1] "2010"

[1] "12"

[1] "16"

$`svn rev`
[1] "53855"

[1] "R"

[1] "R version 2.12.1 (2010-12-16)"

Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil_at_dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                       Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k

R-help_at_r-project.org 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 Fri 11 Mar 2011 - 19:09:39 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 Fri 11 Mar 2011 - 19:40:22 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.

list of date sections of archive