Hi:
Here's an example of how one might do this in a specific example using
geom_text().
# Some fake data:
df <- data.frame(x = 1:10, y = 0.5 + (1:10) + rnorm(10))
# Fit a linear model to the data and save the model object:
mod <- lm(y ~ x, data = df)
# Create a list of character strings - the f
Jim, you can use the function appended below, which is part of package
HandyStuff. If you want an example, see ?lmEqn after installing HandyStuff,
available at github.com/bryanhanson/HandyStuff. Bryan
lmEqn <-
function(df = NULL, y = NULL, x = NULL,
method = "lm", leg.loc = c(0, 0),
Hello -
So I am trying to use ggplot2 to show a linear regression between two
variables, but I want to also show the fit of the line on the graph as well.
I am using ggplot2 for other graphics in what I am working on, so even though
this would be a fairly easy thing to do in Excel, I would pre
3 matches
Mail list logo