Skip to contents

Creates tables to describe different objects (see list of supported objects in report()).

Usage

report_table(x, ...)

Arguments

x

The R object that you want to report (see list of of supported objects above).

...

Arguments passed to or from other methods.

Value

An object of class report_table().

Examples

# \donttest{
# Miscellaneous
r <- report_table(sessionInfo())
r
#> Package     | Version |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Reference
#> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#> Matrix      |   1.5.3 |                                                                                                                                                                                                                                                                                                                                                                                                                                                  Bates D, Maechler M, Jagan M (2022). _Matrix: Sparse and Dense Matrix Classes and Methods_. https://Matrix.R-forge.R-project.org/, https://Matrix.R-forge.R-project.org/doxygen/.
#> R           |   4.2.2 |                                                                                                                                                                                                                                                                                                                                                                                                                                                              R Core Team (2022). _R: A Language and Environment for Statistical Computing_. R Foundation for Statistical Computing, Vienna, Austria. <https://www.R-project.org/>.
#> Rcpp        |  1.0.10 | Eddelbuettel D, François R (2011). “Rcpp: Seamless R and C++ Integration.” _Journal of Statistical Software_, *40*(8), 1-18. doi:10.18637/jss.v040.i08 <https://doi.org/10.18637/jss.v040.i08>. Eddelbuettel D (2013). _Seamless R and C++ Integration with Rcpp_. Springer, New York. doi:10.1007/978-1-4614-6868-4 <https://doi.org/10.1007/978-1-4614-6868-4>, ISBN 978-1-4614-6867-7. Eddelbuettel D, Balamuta JJ (2018). “Extending extitR with extitC++: A Brief Introduction to extitRcpp.” _The American Statistician_, *72*(1), 28-36. doi:10.1080/00031305.2017.1375990 <https://doi.org/10.1080/00031305.2017.1375990>.
#> bayestestR  |  0.13.0 |                                                                                                                                                                                                                                                                                               Makowski D, Ben-Shachar M, Lüdecke D (2019). “bayestestR: Describing Effects and their Uncertainty, Existence and Significance within the Bayesian Framework.” _Journal of Open Source Software_, *4*(40), 1541. doi:10.21105/joss.01541 <https://doi.org/10.21105/joss.01541>, <https://joss.theoj.org/papers/10.21105/joss.01541>.
#> dplyr       |   1.1.0 |                                                                                                                                                                                                                                                                                                                                                                                                                                                              Wickham H, François R, Henry L, Müller K, Vaughan D (2023). _dplyr: A Grammar of Data Manipulation_. https://dplyr.tidyverse.org, https://github.com/tidyverse/dplyr.
#> lavaan      |  0.6.13 |                                                                                                                                                                                                                                                                                                                                                                                                                                    Rosseel Y (2012). “lavaan: An R Package for Structural Equation Modeling.” _Journal of Statistical Software_, *48*(2), 1-36. doi:10.18637/jss.v048.i02 <https://doi.org/10.18637/jss.v048.i02>.
#> lme4        |  1.1.31 |                                                                                                                                                                                                                                                                                                                                                                                                              Bates D, Mächler M, Bolker B, Walker S (2015). “Fitting Linear Mixed-Effects Models Using lme4.” _Journal of Statistical Software_, *67*(1), 1-48. doi:10.18637/jss.v067.i01 <https://doi.org/10.18637/jss.v067.i01>.
#> performance |  0.10.2 |                                                                                                                                                                                                                                                                                                                                                       Lüdecke D, Ben-Shachar M, Patil I, Waggoner P, Makowski D (2021). “performance: An R Package for Assessment, Comparison and Testing of Statistical Models.” _Journal of Open Source Software_, *6*(60), 3139. doi:10.21105/joss.03139 <https://doi.org/10.21105/joss.03139>.
#> report      |   0.5.6 |                                                                                                                                                                                                                                                                                                                                                                                                        Makowski D, Lüdecke D, Patil I, Thériault R (2023). “Automated Results Reporting as a Practical Tool to Improve Reproducibility and Methodological Best Practices Adoption.” _CRAN_. <https://easystats.github.io/report/>.
#> rstanarm    |  2.21.3 |                                                                                                                                                                                                                      Goodrich B, Gabry J, Ali I, Brilleman S (2022). “rstanarm: Bayesian applied regression modeling via Stan.” R package version 2.21.3, <https://mc-stan.org/rstanarm/>. Brilleman S, Crowther M, Moreno-Betancur M, Buros Novik J, Wolfe R (2018). “Joint longitudinal and time-to-event models via Stan.” StanCon 2018. 10-12 Jan 2018. Pacific Grove, CA, USA., <https://github.com/stan-dev/stancon_talks/>.
summary(r)
#> Package     | Version
#> ---------------------
#> Matrix      |   1.5.3
#> R           |   4.2.2
#> Rcpp        |  1.0.10
#> bayestestR  |  0.13.0
#> dplyr       |   1.1.0
#> lavaan      |  0.6.13
#> lme4        |  1.1.31
#> performance |  0.10.2
#> report      |   0.5.6
#> rstanarm    |  2.21.3

# Data
report_table(iris$Sepal.Length)
#> Mean |   SD | Median |  MAD |  Min |  Max | n_Obs | Skewness | Kurtosis | percentage_Missing
#> --------------------------------------------------------------------------------------------
#> 5.84 | 0.83 |   5.80 | 1.04 | 4.30 | 7.90 |   150 |     0.31 |    -0.55 |               0.00
report_table(as.character(round(iris$Sepal.Length, 1)))
#> n_Entries | n_Obs | n_Missing | percentage_Missing
#> --------------------------------------------------
#> 35.00     |   150 |         0 |               0.00
report_table(iris$Species)
#> Level      | n_Obs | percentage_Obs
#> -----------------------------------
#> setosa     |    50 |          33.33
#> versicolor |    50 |          33.33
#> virginica  |    50 |          33.33
report_table(iris)
#> Variable     |      Level | n_Obs | percentage_Obs | Mean |   SD | Median |  MAD |  Min |  Max | Skewness | Kurtosis | percentage_Missing
#> -----------------------------------------------------------------------------------------------------------------------------------------
#> Sepal.Length |            |   150 |                | 5.84 | 0.83 |   5.80 | 1.04 | 4.30 | 7.90 |     0.31 |    -0.55 |               0.00
#> Sepal.Width  |            |   150 |                | 3.06 | 0.44 |   3.00 | 0.44 | 2.00 | 4.40 |     0.32 |     0.23 |               0.00
#> Petal.Length |            |   150 |                | 3.76 | 1.77 |   4.35 | 1.85 | 1.00 | 6.90 |    -0.27 |    -1.40 |               0.00
#> Petal.Width  |            |   150 |                | 1.20 | 0.76 |   1.30 | 1.04 | 0.10 | 2.50 |    -0.10 |    -1.34 |               0.00
#> Species      |     setosa |    50 |          33.33 |      |      |        |      |      |      |          |          |                   
#> Species      | versicolor |    50 |          33.33 |      |      |        |      |      |      |          |          |                   
#> Species      |  virginica |    50 |          33.33 |      |      |        |      |      |      |          |          |                   

# h-tests
report_table(t.test(mtcars$mpg ~ mtcars$am))
#> Welch Two Sample t-test
#> 
#> Parameter  |     Group | Mean_Group1 | Mean_Group2 | Difference |          95% CI | t(18.33) |     p | Cohen's d |   Cohens_d  CI
#> ---------------------------------------------------------------------------------------------------------------------------------
#> mtcars$mpg | mtcars$am |       17.15 |       24.39 |      -7.24 | [-11.28, -3.21] |    -3.77 | 0.001 |     -1.41 | [-2.26, -0.53]
#> 
#> Alternative hypothesis: two.sided

# ANOVAs
report_table(aov(Sepal.Length ~ Species, data = iris))
#> Parameter | Sum_Squares |  df | Mean_Square |      F |      p | Eta2 |  Eta2 95% CI
#> -----------------------------------------------------------------------------------
#> Species   |       63.21 |   2 |       31.61 | 119.26 | < .001 | 0.62 | [0.54, 1.00]
#> Residuals |       38.96 | 147 |        0.27 |        |        |      |             

# GLMs
report_table(lm(Sepal.Length ~ Petal.Length * Species, data = iris))
#> Parameter                           | Coefficient |         95% CI | t(144) |      p | Std. Coef. | Std. Coef. 95% CI |    Fit
#> ------------------------------------------------------------------------------------------------------------------------------
#> (Intercept)                         |        4.21 | [ 3.41,  5.02] |  10.34 | < .001 |       0.49 |    [-1.03,  2.01] |       
#> Petal Length                        |        0.54 | [ 0.00,  1.09] |   1.96 | 0.052  |       1.16 |    [-0.01,  2.32] |       
#> Species [versicolor]                |       -1.81 | [-2.99, -0.62] |  -3.02 | 0.003  |      -0.88 |    [-2.41,  0.65] |       
#> Species [virginica]                 |       -3.15 | [-4.41, -1.90] |  -4.97 | < .001 |      -1.75 |    [-3.32, -0.18] |       
#> Petal Length × Species [versicolor] |        0.29 | [-0.30,  0.87] |   0.97 | 0.334  |       0.61 |    [-0.63,  1.85] |       
#> Petal Length × Species [virginica]  |        0.45 | [-0.12,  1.03] |   1.56 | 0.120  |       0.97 |    [-0.26,  2.19] |       
#>                                     |             |                |        |        |            |                   |       
#> AIC                                 |             |                |        |        |            |                   | 106.77
#> AICc                                |             |                |        |        |            |                   | 107.56
#> BIC                                 |             |                |        |        |            |                   | 127.84
#> R2                                  |             |                |        |        |            |                   |   0.84
#> R2 (adj.)                           |             |                |        |        |            |                   |   0.83
#> Sigma                               |             |                |        |        |            |                   |   0.34
report_table(glm(vs ~ disp, data = mtcars, family = "binomial"))
#> Parameter   | Coefficient |         95% CI |     z |     p | Std. Coef. | Std. Coef. 95% CI |   Fit
#> ---------------------------------------------------------------------------------------------------
#> (Intercept) |        4.14 | [ 1.81,  7.44] |  2.98 | 0.003 |      -0.85 |    [-2.42,  0.27] |      
#> disp        |       -0.02 | [-0.04, -0.01] | -3.03 | 0.002 |      -2.68 |    [-4.90, -1.27] |      
#>             |             |                |       |       |            |                   |      
#> AIC         |             |                |       |       |            |                   | 26.70
#> AICc        |             |                |       |       |            |                   | 27.11
#> BIC         |             |                |       |       |            |                   | 29.63
#> Tjur's R2   |             |                |       |       |            |                   |  0.53
#> Sigma       |             |                |       |       |            |                   |  0.87
#> Log_loss    |             |                |       |       |            |                   |  0.35
# }

# \donttest{
# Mixed models
library(lme4)
model <- lme4::lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris)
report_table(model)
#> Parameter        | Coefficient |       95% CI | t(146) |      p | Effects |    Group | Std. Coef. | Std. Coef. 95% CI |    Fit
#> ------------------------------------------------------------------------------------------------------------------------------
#> (Intercept)      |        2.50 | [1.19, 3.82] |   3.75 | < .001 |   fixed |          |  -1.46e-13 |     [-1.49, 1.49] |       
#> Petal Length     |        0.89 | [0.76, 1.01] |  13.93 | < .001 |   fixed |          |       1.89 |     [ 1.63, 2.16] |       
#>                  |        1.08 |              |        |        |  random |  Species |            |                   |       
#>                  |        0.34 |              |        |        |  random | Residual |            |                   |       
#>                  |             |              |        |        |         |          |            |                   |       
#> AIC              |             |              |        |        |         |          |            |                   | 127.79
#> AICc             |             |              |        |        |         |          |            |                   | 128.07
#> BIC              |             |              |        |        |         |          |            |                   | 139.84
#> R2 (conditional) |             |              |        |        |         |          |            |                   |   0.97
#> R2 (marginal)    |             |              |        |        |         |          |            |                   |   0.66
#> Sigma            |             |              |        |        |         |          |            |                   |   0.34
# }
# \donttest{
# Bayesian models
library(rstanarm)
model <- suppressWarnings(stan_glm(Sepal.Length ~ Species, data = iris, refresh = 0, iter = 600))
report_table(model, effectsize_method = "basic")
#> Parameter         | Median |       95% CI |   pd |  Rhat |     ESS |                 Prior | Std. Median | Std_Median 95% CI |     Fit
#> --------------------------------------------------------------------------------------------------------------------------------------
#> (Intercept)       |   5.01 | [4.86, 5.14] | 100% | 0.999 |  890.00 | Normal (5.84 +- 2.07) |        0.00 |      [0.00, 0.00] |        
#> Speciesversicolor |   0.93 | [0.72, 1.13] | 100% | 0.998 |  856.00 | Normal (0.00 +- 4.38) |        0.53 |      [0.41, 0.65] |        
#> Speciesvirginica  |   1.58 | [1.38, 1.79] | 100% | 1.000 | 1062.00 | Normal (0.00 +- 4.38) |        0.90 |      [0.79, 1.02] |        
#>                   |        |              |      |       |         |                       |             |                   |        
#> ELPD              |        |              |      |       |         |                       |             |                   | -115.88
#> LOOIC             |        |              |      |       |         |                       |             |                   |  231.75
#> WAIC              |        |              |      |       |         |                       |             |                   |  231.70
#> R2                |        |              |      |       |         |                       |             |                   |    0.61
#> R2 (adj.)         |        |              |      |       |         |                       |             |                   |    0.61
#> Sigma             |        |              |      |       |         |                       |             |                   |    0.52
# }
# \donttest{
# Structural Equation Models (SEM)
library(lavaan)
structure <- "ind60 =~ x1 + x2 + x3
              dem60 =~ y1 + y2 + y3
              dem60 ~ ind60"
model <- lavaan::sem(structure, data = PoliticalDemocracy)
suppressWarnings(report_table(model))
#> Parameter     | Coefficient |       95% CI |     z |      p |  Component |     Fit
#> ----------------------------------------------------------------------------------
#> ind60 =~ x1   |        1.00 | [1.00, 1.00] |       | < .001 |    Loading |        
#> ind60 =~ x2   |        2.18 | [1.91, 2.45] | 15.59 | < .001 |    Loading |        
#> ind60 =~ x3   |        1.82 | [1.52, 2.12] | 11.96 | < .001 |    Loading |        
#> dem60 =~ y1   |        1.00 | [1.00, 1.00] |       | < .001 |    Loading |        
#> dem60 =~ y2   |        1.04 | [0.66, 1.43] |  5.33 | < .001 |    Loading |        
#> dem60 =~ y3   |        0.98 | [0.65, 1.30] |  5.89 | < .001 |    Loading |        
#> dem60 ~ ind60 |        1.37 | [0.53, 2.21] |  3.20 | 0.001  | Regression |        
#>               |             |              |       |        |            |        
#> Chi2          |             |              |       |        |            |    7.98
#> Chi2_df       |             |              |       |        |            |    8.00
#> p_Chi2        |             |              |       |        |            |    0.44
#> p_Baseline    |             |              |       |        |            |    0.00
#> GFI           |             |              |       |        |            |    0.97
#> AGFI          |             |              |       |        |            |    0.91
#> NFI           |             |              |       |        |            |    0.97
#> NNFI          |             |              |       |        |            |    1.00
#> CFI           |             |              |       |        |            |    1.00
#> RMSEA         |             |              |       |        |            |    0.00
#> RMSEA_CI_low  |             |              |       |        |            |    0.00
#> RMSEA_CI_high |             |              |       |        |            |    0.14
#> p_RMSEA       |             |              |       |        |            |    0.57
#> RMR           |             |              |       |        |            |    0.10
#> SRMR          |             |              |       |        |            |    0.03
#> RFI           |             |              |       |        |            |    0.95
#> PNFI          |             |              |       |        |            |    0.52
#> IFI           |             |              |       |        |            |    1.00
#> RNI           |             |              |       |        |            |    1.00
#> Loglikelihood |             |              |       |        |            | -778.27
#> AIC           |             |              |       |        |            | 1582.54
#> BIC           |             |              |       |        |            | 1612.67
#> BIC (adj.)    |             |              |       |        |            | 1571.69
# }