# NOT RUN {
# Regression example
my.df <-
data.frame(X = c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1),
Y = c( 2.6, 3.1, 2.5, 5.0, 3.6, 4.0, 5.2, 2.8, 3.8))
ggplot(my.df, aes(X, Y)) +
geom_point() +
stat_fit_tidy(method = "lm",
method.args = list(formula = y ~ x),
mapping = aes(label = sprintf("Slope = %.3g\np-value = %.3g",
stat(x_estimate), stat(x_p.value))))
# }
Run the code above in your browser using DataLab