knitr::opts_chunk$set( collapse = TRUE, warning = FALSE, message = FALSE, out.width = "100%", comment = "#" ) options( knitr.kable.NA = "", width = 60 ) pkgs <- c("dplyr", "lme4") successfully_loaded <- vapply(pkgs, requireNamespace, FUN.VALUE = logical(1L), quietly = TRUE) can_evaluate <- all(successfully_loaded) if (can_evaluate) { knitr::opts_chunk$set(eval = TRUE) vapply(pkgs, require, FUN.VALUE = logical(1L), quietly = TRUE, character.only = TRUE) } else { knitr::opts_chunk$set(eval = FALSE) } library(report)
First, install R and R studio. Then, copy and paste the following lines in the console:
install.packages("remotes") remotes::install_github("easystats/report") # You only need to do that once
library("report") # Load the package every time you start R
Great! The report
package is now installed and loaded in your session.
The report
package works in a two step fashion:
- First, you create a report
object with the report()
function.
- Second, this report object can be displayed either textually (the default
output) or as a table, using as.data.frame()
. Moreover, you can also access a
more compact version of the report using summary()
on the report object.
If an entire dataframe is supplied, report
will provide descriptive statistics
for all columns:
report(iris)
The dataframe can also be a grouped dataframe (from {dplyr}
package), in which case
report
would return a separate report for each level of the grouping variable.
Additionally, instead of textual summary, report
also allows one to return a
tabular summary using the report_table()
function:
iris %>% group_by(Species) %>% report_table()
report
can also be used to provide automated summaries for statistical model
objects from correlation, t-tests, Wilcoxon tests, etc.
report(t.test(formula = mtcars$wt ~ mtcars$am))
report(cor.test(mtcars$mpg, mtcars$wt))
lm
)We will start out simple: a simple linear regression
model <- lm(wt ~ am + mpg, data = mtcars) report(model)
aov
)And its close cousin ANOVA is also covered by report
:
model <- aov(wt ~ am + mpg, data = mtcars) report(model)
glm
)model <- glm(vs ~ mpg + cyl, data = mtcars, family = "binomial") report(model)
merMod
)library(lme4) model <- lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy) report(model)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.