Skip to content
Prev 11798 / 398502 Next

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

Hi!

I am fitting a plane to a surface:

This works excellent:
---------------------------------
x<-dataframe[,1]
y<-dataframe[,2]
z<-dataframe[,3]
data<-cbind(x,y,z)

# Fit plane to surface
result<-lm(z~x+y,data)
---------------------------------

But I need to rescale the x,y parameters. So:
-----------------------------
x<-dataframe[,1]*149
y<-dataframe[,2]*149
z<-dataframe[,3]
data<-cbind(x,y,z)

# Fit plane to surface
result<-lm(z~x+y,data)
----------------------------------

And surprisingly this does not work. Error message is:

Error in eval(attr(formula, "variables"), data, env) : 
        sys.frame: not that many enclosing functions

Why does this happen?


kind regards
Tomas Svensson
EVOTEC,Hamburg


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._