Create a gist now

Instantly share code, notes, and snippets.

ggplot or Lattice Fit Line in R
ols <- lm(Temp ~ Solar.R,
data = airquality)
summary(ols)
str(ols)
plot(Temp ~ Solar.R,
data = airquality)
abline(ols)
library(ggplot2)
# ggplot(data = airquality,
# aes(Solar.R, Temp)) +
# geom_point(pch = 19) +
# geom_abline(intercept = ols$coefficients[1],
# slope = ols$coefficients[2])
ggplot(data = airquality,
aes(Solar.R, Temp)) +
geom_point(pch = 19) +
geom_smooth(method = lm,
se = FALSE)
library(lattice)
xyplot(Temp ~ Solar.R,
data = airquality,
type = c("p", "r"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment