search for: plotwithfits

Displaying 1 result from an estimated 1 matches for "plotwithfits".

2007 Nov 15
1
Writing a helper function that takes in the dataframe and variable names and then does a subset and plot
Hi, I have a large dataframe than I'm writing functions to explore, and to reduce cut and paste I'm trying to write a function that does a subset and then a plot. Firstly, I can write a wrapper around a plot: plotwithfits <- function(formula, data, xylabels=c('','')) { xyplot(formula, data, panel = function(x,y, ...) { panel.xyplot(x,y, ...) panel.abline(lm(y~x),lwd=2, ...) panel.loess(x,y,lwd=2,col.line='red', ...) },...