RPregression {RPregression} | R Documentation |
Perform Regression Analysis and Plot Results
Description
This function allows you to run a regression analysis, generate a regression table, create a scatter plot, and download the results, all without the need for additional packages such as 'stargazer', 'ggplot2', or 'ggthemes'. With just two lines of code, you can perform a regression analysis, visualize the results, and save the output.
Usage
RPregression(x, y, table = "text", plot = FALSE, xlab = "", ylab = "",
title = "", subtitle = "", caption = "", plottheme = "theme_grey()",
download = FALSE, color_points = "black", color_line = "red",
ci = TRUE, sd = FALSE)
Arguments
x |
The independent variable. |
y |
The dependent variable. |
table |
The format for the regression table ("text", "html", or "latex"). |
plot |
Logical, whether to generate a plot. |
xlab |
Label for x-axis in the plot. |
ylab |
Label for y-axis in the plot. |
title |
The title for the regression table and plot. |
subtitle |
Subtitle for the plot (optional). |
caption |
Caption for the plot (optional). |
plottheme |
Theme for the plot (default is "theme_grey()"). |
download |
Logical, whether to save the regression table as a text file. |
color_points |
Color for points in the plot (default is "black"). |
color_line |
Color for the regression line (default is "red"). |
ci |
Logical, whether to include confidence interval in the plot (default is TRUE). |
sd |
Logical, whether to include standard deviation bars in the plot (default is FALSE). |
Value
If plot is TRUE, a plot is generated. Otherwise, a regression table is printed.
Author(s)
Raghav Puri Maintainer: Raghav Puri <itsraghavpuri@gmail.com>
Examples
RPregression(mtcars$mpg, mtcars$wt, table = "text", title = "Regression Analysis",
plot = TRUE, xlab = "mpg", ylab = "wt", plottheme = "theme_grey()", download = FALSE)