r - how to plot regression line with specification of formula -
i'm trying plot regression line passes through origin. utilize next code:
library(ggplot2) library(iswr) thuesen cc <- complete.cases(thuesen) tcc <- thuesen[cc,] attach(tcc) m <- lm(short.velocity~blood.glucose -1) m graph <- ggplot(data=tcc, aes(x=blood.glucose, y=short.velocity)) + geom_point() graph + geom_smooth(method="lm", formula=m) error in model.frame.lm(formula = formula, info = data, weights = weight, : objet 'weight' introuvable
i don't understand error message, has solution issue ?
to utilize same formula within ggplot2
:
graph + geom_smooth(method="lm", formula=y~x-1)
r ggplot2 formula lm
No comments:
Post a Comment