[R] Error using lm(z~x+y,data)

Duncan Murdoch murdoch at stats.uwo.ca
Wed Jun 20 17:16:03 CEST 2001

I don't know why one version works and the other doesn't, but I've
noticed problems in the past when using "data" as a variable name, and
in fact even the first version fails for me when I type it exactly as
you did.

I suspect the strange behaviour you saw is related to the fact that
data is a matrix rather than a data.frame, and indeed everything is
fine if I change your code to

d<-data.frame(x,y,z)    # use data.frame, not cbind

# Fit plane to surface

Duncan Murdoch

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list