>> col=c("blue","red")mydfr$[treatment] > > Yes, but I would like to use the function for lots of other dataframes > as well, so embedding 'mydfr' in the function is not the ideal > solution...
In that case I'd try something like: myplot <- function(..., tmnt) { plot(..., pch=19, col=c("blue","red")[tmnt] ) } with(mydfr, myplot(Xmeas, Ymeas, tmnt=treatment)) That seems to work... - basically you just need to pass treatment in the function call... ******************************************************************************************************************** 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.