Re: [R] plot with a regression line(s)

2012-04-04 Thread S Ellison
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Sam Steingold > > plot.glm <- function (x, y, file = NULL, xlab = > deparse(substitute(x)), > ylab = deparse(substitute(y)), main = NULL) { > m <- glm(

Re: [R] plot with a regression line(s)

2012-04-04 Thread David Winsemius
On Apr 4, 2012, at 11:30 AM, R. Michael Weylandt > wrote: I'm not sure what your definition of easier would be, but there are some style things you might want to be aware of: I) the name is likely to hit up against the S3 generic plot() when applied to a glm object. This might lead to str

Re: [R] plot with a regression line(s)

2012-04-04 Thread R. Michael Weylandt
I'm not sure what your definition of easier would be, but there are some style things you might want to be aware of: I) the name is likely to hit up against the S3 generic plot() when applied to a glm object. This might lead to strange bugs at some point. II) you can test !is.null once and use

[R] plot with a regression line(s)

2012-04-04 Thread Sam Steingold
I am sure a common need is to plot a scatterplot with some fitted line(s) and maybe save to a file. I have this: plot.glm <- function (x, y, file = NULL, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), main = NULL) { m <- glm(y ~ x) if (!is.null(file)) p