> > # I tried defining a function like this > myplot <- function(...)plot(..., pch=19, col=c("blue","red")[treatment]) > > # So i can call it like this: > with(mydfr, myplot(Xmeas, Ymeas)) > > # but: > Error in plot.xy(xy, type, ...) : object 'treatment' not found > basically that is something like calling:
myplot( mydfr$Xmeas, mydfr$Ymeas ) So plot doesn't know that treatment is within mydfr... changing your function to: myplot <- function(...) { plot(..., pch=19, col=c("blue","red")mydfr$[treatment] ) } should work? ******************************************************************************************************************** This message may contain confidential information. If yo...{{dropped:21}} ______________________________________________ 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.