Description Usage Arguments Author(s) See Also Examples
lm_equation
is used for creating a string which can be plotted with
ggplot2.
1 | lm_equation(df, y, x, labels = TRUE, zero_intercept = FALSE, digits = 3)
|
df |
Data frame. |
y |
y-variable. |
x |
x-variable. |
labels |
Should the equation show variable names rather than a generic
y and x? Default is |
digits |
Number of digits to display for the coefficents in the
equation. Default is |
Ramnath Vaidyanathan with some enhancement by Stuart K. Grange
1 2 3 4 5 6 7 8 9 | ## Not run:
# Use annotation with ggplot
ggplot(data_my1, aes(nox, bc)) + geom_point() + stat_smooth(method = lm) +
annotate("text", x = 200, y = 45, label = lm_equation(data_my1, "bc", "nox"),
parse = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.