[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()
$platform
[1] "i386-pc-mingw32"

$arch
[1] "i386"

$os
[1] "mingw32"

$system
[1] "i386, mingw32"

$status
[1] ""

$major
[1] "2"

$minor
[1] "12.1"

$year
[1] "2010"

$month
[1] "12"

$day
[1] "16"

$`svn rev`
[1] "53855"

$language
[1] "R"

$version.string
[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