"Perform simple linear regression calculations and return the corresponding plot."
Source:R/lm_and_plot.R
lm_and_plot.Rd
"Perform simple linear regression calculations and return the corresponding plot."
Arguments
- data
The input data frame contains information such as @param x, @param y, @param group, and @param color.
- x
Independent variable, which is also used as the X-axis in the plot.
- y
Dependent variable, which is also used as the Y-axis in the plot.
- group
The column name used to differentiate groups, which also serves as the grouping information for batch calculations of regression coefficients and P-values.
- color
The color of the scatter plot in the graph.
Value
A list containing a data frame and a plot, where the data frame includes regression coefficients and P-values, and the plot is a scatter plot.
Examples
library(biohelpers)
df <- iris
lm_and_plot(
data = df,
x = "Sepal.Length",
y = "Sepal.Width",
group = "Species",
color = "Species"
) -> results.lm