Hello,

I am plotting glms with logged predictors. I would like to define the
logged variables "on the fly" rather than hard coding them into my
dataframe.

This code (with hard-coded logged variables) works just fine:

xx<-seq(-2,.5,by=0.1); lines(xx,predict(power,list(LogArKm00=xx),type=
"response"),col="black",lwd=2,lty=1) #LogArKm00 is a variable in my
dataframe

but my attempt to define them "on the fly" doesn't work (see error below):

plot(log(WbAb,10)~log(ArKm00,10),data=dat) #power model

xx<-seq(-2,.5,by=0.1); lines(xx,predict(power,list(log(ArKm00,10)=xx),type=
"response"),col="black",lwd=2,lty=1) #trying to log the variable "on the
fly"


Error: unexpected '=' in " lines(xx,predict(power,list(log(ArKm00,10)="

I would really appreciate any help sorting this out!

Many thanks

Mark

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to