Title: | A Simple Regression and Plotting Tool |
---|---|
Description: | Perform a regression analysis, generate a regression table, create a scatter plot, and download the results. It uses 'stargazer' for generating regression tables and 'ggplot2' for creating plots. With just two lines of code, you can perform a regression analysis, visualize the results, and save the output. It is part of my make R easy project where one doesn't need to know how to use various packages in order to get results and makes it easily accessible to beginners. This is a part of my make R easy project. Help from 'ChatGPT' was taken. References were Wickham (2016) <doi:10.1007/978-3-319-24277-4>. |
Authors: | Raghav Puri [aut, cre] |
Maintainer: | Raghav Puri <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2025-02-11 04:26:55 UTC |
Source: | https://github.com/cran/RPregression |
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.
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)
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)
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). |
If plot is TRUE, a plot is generated. Otherwise, a regression table is printed.
Raghav Puri Maintainer: Raghav Puri <[email protected]>
RPregression(mtcars$mpg, mtcars$wt, table = "text", title = "Regression Analysis", plot = TRUE, xlab = "mpg", ylab = "wt", plottheme = "theme_grey()", download = FALSE)
RPregression(mtcars$mpg, mtcars$wt, table = "text", title = "Regression Analysis", plot = TRUE, xlab = "mpg", ylab = "wt", plottheme = "theme_grey()", download = FALSE)