[R] Automated plot and linear regression line/data

Greg Snow Greg.Snow at imail.org
Thu Aug 19 20:30:06 CEST 2010


?pairs
?lattice::splom
?lattice::panel.xyplot


pairs( state.x77, panel=function(x,y){
	points(x,y)
	abline(lm(y~x), col='red')
})

library(lattice)
splom( ~state.x77, type=c('p','r') )



-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of ashz
> Sent: Tuesday, August 17, 2010 3:47 AM
> To: r-help at r-project.org
> Subject: [R] Automated plot and linear regression line/data
> 
> 
> Hi,
> 
> I have an excel sheet (already imported to R) with multiple columns and
> I am
> looking for a way in R that will allow me to generate a plot for every
> possible pair and its linear regression line/data.
> 
> Any tip/idea/script how do to so.
> 
> Thanks,
> As hz
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Automated-
> plot-and-linear-regression-line-data-tp2328027p2328027.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list