Description Usage Arguments Value Examples
View source: R/NumCatPredictors_lm.R
Linear model plot function with 'ggplot2' Function for plotting a linear regression model using the 'ggplot2' package. This function includes a colored trend line.
1 | lm_num_cat(ants, min_ma, max_ma, subfamily)
|
data |
A data frame. |
response |
A column in the data frame to be used as a response variable. |
num_predictor |
A column in the data frame containing numerical values to be used as the predictor variable. |
cat_predictor |
A column in the data frame containing categorical values to be used as an additional predictor variable distinguished by color; If left blank, the linear regression plot will be returned with only one predictor value. |
A linear regression plot with a colored trend line.
1 2 3 4 5 6 7 8 | ants %>%
change_na_rm("None") %>%
lm_num_cat(min_ma, max_ma)
ants %>%
change_na_rm("None") %>%
lm_num_cat(min_ma, max_ma, Genus) +
annotate("text", x = 42, y = 27,
label = "R^2 == 0.987", parse = TRUE, size = 4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.