View source: R/plot_3d_regression.R
| plot_3d_regression | R Documentation |
Build an interactive 3D scatterplot of an outcome against two numeric
predictors, overlaid with the fitted plane from lm(formula, data).
Returns a plotly htmlwidget that you can render in
an R Markdown / Quarto document or in the RStudio Viewer.
plot_3d_regression(data, formula, n = 25)
data |
a data frame containing the three variables in |
formula |
a formula of the form |
n |
grid resolution per axis used to draw the regression plane.
Default |
Requires the suggested package plotly. Install it with
install.packages("plotly") if you see an error about it being missing.
A plotly htmlwidget object.
get_regression_table(), get_regression_points()
## Not run:
library(moderndive)
plot_3d_regression(
un_member_states_2024,
life_expectancy_2022 ~ gdp_per_capita + fertility_rate_2022
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.