### Install and Load the easystats/report R Package Source: https://easystats.github.io/report/reference/report/articles/report This snippet provides the R commands to install the 'report' package from GitHub using 'remotes' and then load it into the R session using 'library()'. Installation is a one-time process, while loading is required for each new R session. ```R install.packages("remotes") remotes::install_github("easystats/report") # You only need to do that once ``` ```R library("report") # Load the package every time you start R ``` -------------------------------- ### R: `install_latest` Function Examples Source: https://easystats.github.io/report/reference/easystats/reference/install_latest Practical examples demonstrating how to use the `install_latest` function to install `easystats` packages, including selective and forced installations. ```R if (FALSE) { # install latest development-version of easystats packages from # the r-universe repository, but only those packages that have newer # versions available install_latest() # install all latest development-version of easystats packages from # the r-universe repository, no matter whether local installations # are up to date or not. install_latest(force = TRUE) } ``` -------------------------------- ### Install easystats and bayestestR Source: https://easystats.github.io/report/reference/bayestestR/articles/bayestestR This code installs the 'remotes' package first, then uses it to install the entire 'easystats' suite directly from GitHub, which includes 'bayestestR'. This is necessary to get the latest development versions of the packages. ```R install.packages("remotes") remotes::install_github("easystats/easystats") ``` -------------------------------- ### R: Examples for `check_if_installed` function Source: https://easystats.github.io/report/reference/insight/reference/check_if_installed Illustrative R code examples demonstrating the usage of the `check_if_installed` function, including checks for installed packages, handling non-existent packages, and specifying minimum version requirements. ```R # \donttest{ check_if_installed("insight") try(check_if_installed("datawizard", stop = FALSE)) try(check_if_installed("rstanarm", stop = FALSE)) try(check_if_installed("nonexistent_package", stop = FALSE)) #> Warning: Package `nonexistent_package` required for this function to work. #> Please install it by running `install.packages("nonexistent_package")`. try(check_if_installed("insight", minimum_version = "99.8.7")) #> Error : Package `insight` is installed, but package version `99.8.7` is #> required. #> Please update it by running `install.packages("insight")`. try(check_if_installed(c("nonexistent", "also_not_here"), stop = FALSE)) #> Warning: Packages `nonexistent` and `also_not_here` required for this function to #> work. #> Please install them by running `install.packages("nonexistent", #> "also_not_here")`. try(check_if_installed(c("datawizard", "rstanarm"), stop = FALSE)) try(check_if_installed(c("datawizard", "rstanarm"), minimum_version = c(NA, "2.21.1"), stop = FALSE )) # } ``` -------------------------------- ### Setup R Environment for 'effectsize' and 'see' Packages Source: https://easystats.github.io/report/reference/see/articles/effectsize Loads the `effectsize` and `see` R packages and prepares sample datasets (`mtcars`, `iris`) for subsequent analysis and plotting examples. ```R library(effectsize) library(see) data(mtcars) data(iris) ``` -------------------------------- ### Install and Load easystats/report Package in R Source: https://easystats.github.io/report/reference/blog/posts/report_correlation This snippet demonstrates how to install the 'report' package directly from GitHub, as it is not yet available on CRAN. It also shows how to load the 'report' and 'dplyr' packages into your R session, which are necessary for the examples. ```R devtools::install_github("easystats/report") library(report) library(dplyr) ``` -------------------------------- ### Install the 'parameters' R package Source: https://easystats.github.io/report/reference/parameters/index Install the 'parameters' package from different sources: CRAN for the stable release, r-universe for development versions, or GitHub for the latest development version. Ensure you have the 'remotes' package installed for GitHub installation. ```R install.packages("parameters") ``` ```R install.packages("parameters", repos = "https://easystats.r-universe.dev") ``` ```R remotes::install_github("easystats/parameters") ``` -------------------------------- ### Performing Meta-Analysis and Parameter Extraction with metafor and parameters Source: https://easystats.github.io/report/reference/blog/posts/parameters_and_see_update This example demonstrates how to conduct a meta-analysis using the `metafor` package and then extract the results using `model_parameters`. It shows the setup of a data frame for effect sizes and standard errors, followed by a Restricted Maximum Likelihood (REML) meta-analysis, and finally the parameter summary including coefficients, standard errors, confidence intervals, p-values, and weights. ```R library(metafor) d <- data.frame( effectsize = c(-0.393, 0.675, 0.282, -1.398), standarderror = c(0.317, 0.317, 0.13, 0.36) ) ma <- rma(yi = effectsize, sei = standarderror, method = "REML", data = d) result <- model_parameters(ma) result ``` -------------------------------- ### Generate Report for Pearson Correlation Test in R Source: https://easystats.github.io/report/reference/report/articles/report Shows how to apply `report()` to the output of a `cor.test()`. This example calculates the correlation between `mpg` (miles per gallon) and `wt` (weight) from the `mtcars` dataset, providing an automated summary of the correlation analysis. ```R report(cor.test(mtcars$mpg, mtcars$wt)) ``` -------------------------------- ### R Example: Managing easystats Dependencies and Reverse Dependencies Source: https://easystats.github.io/report/reference/easystats/reference/install_suggested Illustrates how to use `install_suggested` to download all recommended packages for easystats (commented out for safety) and `show_reverse_dependencies` to list packages that depend on easystats components, including their output. ```R # download all suggested packages if (FALSE) { install_suggested("easystats") } # listing all reverse dependencies of easystats packages show_reverse_dependencies() #> bayestestR #> ---------- #> BaHZING, bayesMeanScale, brmsmargins, clinicalsignificance, correlation, #> easystats, eDNAjoint, effectsize, fbst, modelbased, multifear, #> multilevelcoda, neatStats, parameters, pcvr, performance, psycho, #> report, rstanbdp, see, sjPlot, snSMART, SSVS, statsExpressions, #> survregVB #> #> correlation #> ----------- #> easystats, ggstatsplot, multitool, popstudy, see, statsExpressions, #> TangledFeatures #> #> datawizard #> ---------- #> bayestestR, correlation, easystats, effectsize, ggeffects, ggstatsplot, #> modelbased, parameters, performance, report, see, sjlabelled, sjmisc, #> sjPlot, sjstats, statsExpressions #> #> effectsize #> ---------- #> bruceR, easystats, multifear, psycho, report, see, sjstats, statdecideR, #> statsExpressions, visvow, volker #> #> insight #> ------- #> aggreCAT, ale, bayestestR, bsitar, clarify, clinicalsignificance, #> correlation, cv, datawizard, DImodelsVis, easystats, EcoMetrics, #> effects, effectsize, ggDoE, ggeffects, ggstatsplot, insurancerating, #> lavaanExtra, marginaleffects, modelbased, modelsummary, MuMIn, mvgam, #> ordbetareg, parameters, performance, pminternal, psycho, psycModel, #> randomizeR, regressinator, report, see, SimplyAgree, sjlabelled, sjmisc, #> sjPlot, sjstats, statsExpressions, tidygam, tinyVAST #> #> modelbased #> ---------- #> easystats, see #> #> parameters #> ---------- #> clintools, correlation, cvms, dotwhisker, easystats, effectsize, #> ggstatsplot, glmglrt, MCM, modelbased, modelsummary, multitool, peramo, #> psycho, psycModel, regport, report, see, sjPlot, sjstats, #> statsExpressions, StroupGLMM #> #> performance #> ----------- #> bruceR, CR2, dotwhisker, easystats, effectsize, ggstatsplot, MDMA, #> MLMusingR, modelsummary, multitool, piecewiseSEM, PLSDAbatch, psycModel, #> pubh, report, SCDA, see, sjPlot, sjstats, statsExpressions, #> steppedwedge, SynergyLMM, ZLAvian #> #> report #> ------ #> easystats, SqueakR #> #> see #> --- #> easystats, jsmodule ``` -------------------------------- ### Install easystats R package development version from GitHub Source: https://easystats.github.io/report/reference/easystats To install the cutting-edge development version of the easystats R package directly from its GitHub repository, use this command. Ensure you have the 'remotes' package installed for this method. ```R remotes::install_github("easystats/easystats") ``` -------------------------------- ### APIDOC: `install_latest` Function Arguments Source: https://easystats.github.io/report/reference/easystats/reference/install_latest Detailed documentation for the arguments of the `install_latest` function, including their types, possible values, and descriptions. ```APIDOC install_latest: source: Character. Either "development", "cran" or "github". If "cran", packages will be installed from the default CRAN mirror returned by getOption("repos")['CRAN']. If "development" (the default), packages are installed from the R-universe repository (https://easystats.r-universe.dev/). "github" installs the latest version from the GitHub-repositories main-branch. However, this option is usually not needed, because R-universe provides latest binaries. Use the "github" option only when R-universe servers are unavailable. packages: Character vector, indicating which packages to be installed. By default, the option "all" will install all easystats packages. force: Logical, if FALSE, only those packages with a newer version number will be installed. Use force=TRUE to force installation of all packages, even if the version number for the locally installed packages is identical to the latest development-versions. Only applies when source="development". verbose: Toggle messages. ``` -------------------------------- ### Generate Report for ANOVA Model in R Source: https://easystats.github.io/report/reference/report/articles/report Demonstrates how `report()` summarizes an ANOVA model (`aov`). The example uses the same predictors (`am`, `mpg`) and response (`wt`) from `mtcars`. The report provides F-statistics, p-values, and partial Eta-squared effect sizes for each main effect. ```R model <- aov(wt ~ am + mpg, data = mtcars) report(model) ``` -------------------------------- ### API Documentation for visualisation_recipe function Source: https://easystats.github.io/report/reference/datawizard/reference/visualisation_recipe Detailed API documentation for the `visualisation_recipe` function, outlining its parameters and their descriptions. ```APIDOC visualisation_recipe(x, ...) x: An `easystats` object. ...: Other arguments passed to other functions. ``` -------------------------------- ### Install easystats R package Source: https://easystats.github.io/report/reference/easystats/index Instructions for installing the easystats R package from various sources: CRAN for stable releases, r-universe for development versions, and GitHub for the latest development builds. The `install_suggested()` function ensures all optional dependencies are installed for a complete experience. ```R install.packages("easystats") install.packages("easystats", repos = "https://easystats.r-universe.dev") remotes::install_github("easystats/easystats") easystats::install_suggested() ``` -------------------------------- ### Installing the 'see' R Package Source: https://easystats.github.io/report/reference/see/index Instructions for installing the 'see' package from different sources: CRAN for stable releases, r-universe for the latest development version, and GitHub for direct development branch access. Users should choose the appropriate command based on their needs. ```R install.packages("see") ``` ```R install.packages("see", repos = "https://easystats.r-universe.dev") ``` ```R remotes::install_github("easystats/see") ``` -------------------------------- ### R Example: Updating easystats packages Source: https://easystats.github.io/report/reference/easystats/reference/easystats_update Examples demonstrating how to use `easystats_update` to check and install updates for easystats packages and their dependencies, or only core packages. ```R if (FALSE) { # check which local easystats-packages (and their dependencies) # are out of date and install updates from CRAN easystats_update() # update only easystats core-packages easystats_update("core") } ``` -------------------------------- ### Generate Report for Welch Two Sample t-test in R Source: https://easystats.github.io/report/reference/report/articles/report Demonstrates how to use the `report()` function to summarize the results of a Welch Two Sample t-test. The example tests the difference in `wt` (weight) by `am` (transmission type) from the `mtcars` dataset, providing a detailed, human-readable interpretation of the test statistics, confidence intervals, p-value, and Cohen's d effect size. ```R report(t.test(formula = mtcars$wt ~ mtcars$am)) ``` -------------------------------- ### Loading and Initializing 'see' and 'easystats' in R Source: https://easystats.github.io/report/reference/see/index Demonstrates how to load the 'see' package into an R session. It also provides a tip to load the entire 'easystats' ecosystem for full functionality and a command to update all 'easystats' packages to their latest versions. ```R library("see") ``` ```R library(easystats) ``` ```R easystats::install_latest() ``` -------------------------------- ### R: Example of get_deviance with Linear Model Source: https://easystats.github.io/report/reference/insight/reference/get_deviance Provides a practical R example demonstrating the use of `get_deviance` to calculate the deviance of a linear model, showing the setup and the resulting output. ```R data(mtcars) x <- lm(mpg ~ cyl, data = mtcars) get_deviance(x) #> [1] 308.3342 ``` -------------------------------- ### Generate Report for Linear Mixed-Effects Model in R Source: https://easystats.github.io/report/reference/report/articles/report Illustrates using `report()` with a linear mixed-effects model (`lmer`) from the `lme4` package. The example predicts `Reaction` based on `Days` with `Subject` as a random effect from the `sleepstudy` dataset. The report provides conditional and marginal R-squared values, intercept, and the effect of fixed predictors (beta, CIs, p-value, standardized beta). ```R library(lme4) model <- lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy) report(model) ``` -------------------------------- ### Building Linear Models in R Source: https://easystats.github.io/report/reference/performance/articles/compare Demonstrates how to construct three simple linear regression models using the `lm()` function in R, explaining the variability in `Sepal.Length` with different predictors from the `iris` dataset. ```R model1 <- lm(Sepal.Length ~ Petal.Length, data = iris) model2 <- lm(Sepal.Length ~ Petal.Width, data = iris) model3 <- lm(Sepal.Length ~ Sepal.Width, data = iris) ``` -------------------------------- ### R Examples for bluebrown_colors function Source: https://easystats.github.io/report/reference/see/reference/bluebrown_colors Demonstrates how to use the `bluebrown_colors` function in R to retrieve hex codes for blue-brown colors. Shows examples for getting all available colors and specific colors. ```R bluebrown_colors() #> lightblue blue darkblue grey lightbrown brown darkbrown #> "#6DC0E0" "#5B93AE" "#1F4454" "#dbdbdb" "#92673C" "#61381A" "#391D07" ``` ```R bluebrown_colors("blue", "brown") #> blue brown #> "#5B93AE" "#61381A" ``` -------------------------------- ### R Usage for easystats Dependency Management Functions Source: https://easystats.github.io/report/reference/easystats/reference/install_suggested Demonstrates the basic usage of `install_suggested`, `show_suggested`, and `show_reverse_dependencies` functions within the easystats ecosystem to manage package dependencies. ```R install_suggested(package = "easystats") show_suggested(package = "easystats") show_reverse_dependencies(package = "easystats") ``` -------------------------------- ### Install 'parameters' R package Source: https://easystats.github.io/report/reference/parameters Instructions for installing the 'parameters' R package from different sources: CRAN for the stable release, r-universe for development versions, and GitHub for the latest development version. ```R install.packages("parameters") ``` ```R install.packages("parameters", repos = "https://easystats.r-universe.dev") ``` ```R remotes::install_github("easystats/parameters") ``` -------------------------------- ### R: Practical Examples of `n_obs` for `lm` and `glm` Models Source: https://easystats.github.io/report/reference/insight/reference/n_obs These examples demonstrate the application of `n_obs` to retrieve observation counts from a linear model (`lm`) fitted to `mtcars` data and a generalized linear model (`glm`) using `cbpp` data. It also illustrates the effect of the `disaggregate = TRUE` argument for binomial models with aggregated data, showing how to get total trials versus data rows. ```R data(mtcars) m <- lm(mpg ~ wt + cyl + vs, data = mtcars) n_obs(m) #> [1] 32 data(cbpp, package = "lme4") m <- glm( cbind(incidence, size - incidence) ~ period, data = cbpp, family = binomial(link = "logit") ) n_obs(m) #> [1] 56 n_obs(m, disaggregate = TRUE) #> [1] 842 ``` -------------------------------- ### Install Suggested Function (easystats) Source: https://easystats.github.io/report/reference/easystats/articles/list_of_functions Reference for the `install_suggested` function from the `easystats` R package, used for managing package installations. ```APIDOC install_suggested (easystats) ``` -------------------------------- ### Install effectsize R package from CRAN Source: https://easystats.github.io/report/reference/effectsize This R command installs the stable release of the 'effectsize' package directly from the Comprehensive R Archive Network (CRAN). It ensures you get the most recent stable version for general use. ```R install.packages("effectsize") ``` -------------------------------- ### APIDOC: easystats Dependency Management Functions Source: https://easystats.github.io/report/reference/easystats/reference/install_suggested Documentation for `install_suggested`, `show_suggested`, and `show_reverse_dependencies` functions, which help manage soft dependencies and view package relationships within the easystats ecosystem. ```APIDOC install_suggested(package = "easystats"): description: Installs suggested packages for easystats or specific easystats components. parameters: package: type: string | NULL default: "easystats" description: | If NULL or "easystats" (the default), all suggested packages for all 'easystats' packages will be installed. If specific packages are specified, only suggested packages for those packages will be installed. returns: type: NULL description: Useful only for its side-effect of installing the needed packages. show_suggested(package = "easystats"): description: Shows the current list of suggested packages for each 'easystats' package. parameters: package: type: string | NULL default: "easystats" description: | If NULL or "easystats" (the default), shows suggested packages for all 'easystats' packages. If specific packages are specified, shows suggested packages only for those packages. returns: type: list | NULL description: A list of suggested packages, primarily for display. show_reverse_dependencies(package = "easystats"): description: Lists all reverse dependencies of easystats packages. parameters: package: type: string | NULL default: "easystats" description: | If NULL or "easystats" (the default), lists reverse dependencies for all 'easystats' packages. If specific packages are specified, lists reverse dependencies only for those packages. returns: type: list | NULL description: A list of packages that depend on the specified easystats components, primarily for display. ``` -------------------------------- ### Example of creating an aovlist object in R Source: https://easystats.github.io/report/reference/circus/reference/aovlist_2 Demonstrates how to generate an `aovlist` object using the `aov` function with an `Error()` term in R. This example uses the `iris` dataset and custom categorical variables to illustrate the setup for an analysis of variance with nested error terms. ```R if (FALSE) { data <- iris data$Cat1 <- rep(c("X", "X", "Y"), length.out = nrow(data)) data$Cat2 <- rep(c("A", "B"), length.out = nrow(data)) aov(Sepal.Length ~ Species * Cat1 + Error(Cat2), data = data) } ``` -------------------------------- ### Install effectsize R package from CRAN Source: https://easystats.github.io/report/reference/effectsize/index This R command installs the stable release of the 'effectsize' package directly from the Comprehensive R Archive Network (CRAN). It is the recommended method for most users to get the latest stable version. ```R install.packages("effectsize") ``` -------------------------------- ### easystats_zen() function Source: https://easystats.github.io/report/reference/easystats/reference/index Provides a welcome message or introductory experience to the easystats 'easyverse'. ```APIDOC easystats_zen() ``` -------------------------------- ### R Example for loading the report package Source: https://easystats.github.io/report/reference/report/reference/report.lm Demonstrates how to load the `report` package in R using `library()`. This snippet is a placeholder for more extensive examples that would typically follow in the documentation. ```R # \donttest{ library(report) ``` -------------------------------- ### R Usage Example for standardize_info Source: https://easystats.github.io/report/reference/parameters/reference/standardize_info Demonstrates the basic usage of the `standardize_info` function and its default S3 method signature in R. ```R standardize_info(model, ...) # Default S3 method standardize_info( model, robust = FALSE, two_sd = FALSE, include_pseudo = FALSE, verbose = TRUE, ... ) ``` -------------------------------- ### Examples for describe_prior function in R Source: https://easystats.github.io/report/reference/bayestestR/reference/describe_prior Provides example R code demonstrating how to use the `describe_prior` function. It includes loading the necessary `bayestestR` library and a placeholder for `rstanarm` models. ```R # \donttest{ library(bayestestR) # rstanarm models ``` -------------------------------- ### R Example: Applying link_function to a GLM Source: https://easystats.github.io/report/reference/insight/reference/link_function Illustrates the use of `link_function` with a `glm` object (Poisson family) to extract its link function. The example demonstrates applying the extracted function to a value and verifies the result against a direct `log` transformation, confirming the function's behavior. ```R # example from ?stats::glm counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12) outcome <- gl(3, 1, 9) treatment <- gl(3, 3) m <- glm(counts ~ outcome + treatment, family = poisson()) link_function(m)(0.3) #> [1] -1.203973 # same as log(0.3) #> [1] -1.203973 ``` -------------------------------- ### R: `sexit()` Function Usage Example Source: https://easystats.github.io/report/reference/bayestestR/reference/sexit Demonstrates the basic syntax for calling the `sexit()` function with its main parameters, providing a quick reference for its invocation. ```R sexit(x, significant = "default", large = "default", ci = 0.95, ...) ``` -------------------------------- ### R Example: report.stanreg Usage (Incomplete) Source: https://easystats.github.io/report/reference/report/reference/report.stanreg An incomplete R code example block, typically used to demonstrate the usage of the `report.stanreg` function. The `\donttest{` comment indicates that the following code might be computationally intensive or require specific setup, and thus should not be run during package checks. ```R # \donttest{ ``` -------------------------------- ### Initialize R `effectsize` Package Source: https://easystats.github.io/report/reference/effectsize/index Demonstrates how to load the `effectsize` package and configure print options for symbols. It also provides a tip to use `library(easystats)` for broader ecosystem access and `easystats::install_latest()` for updates. ```R library(effectsize) options(es.use_symbols = TRUE) # get nice symbols when printing! (On Windows, requires R >= 4.2.0) ``` -------------------------------- ### R Example: Extracting random effects data with get_random Source: https://easystats.github.io/report/reference/insight/reference/get_random Demonstrates how to use the `get_random` function in R to extract random effects data from an `lmer` model. The example includes data preparation, fitting a mixed-effects model, and displaying the head of the extracted random effects data. ```R data(sleepstudy) # prepare some data... sleepstudy$mygrp <- sample(1:5, size = 180, replace = TRUE) sleepstudy$mysubgrp <- NA for (i in 1:5) { filter_group <- sleepstudy$mygrp == i sleepstudy$mysubgrp[filter_group] <- sample(1:30, size = sum(filter_group), replace = TRUE) } m <- lmer( Reaction ~ Days + (1 | mygrp / mysubgrp) + (1 | Subject), data = sleepstudy ) #> boundary (singular) fit: see help('isSingular') head(get_random(m)) #> mysubgrp mygrp Subject #> 1 9 5 308 #> 2 7 4 308 #> 3 12 2 308 #> 4 18 4 308 #> 5 24 5 308 #> 6 21 4 308 ``` -------------------------------- ### R: Practical examples for `get_weights` with `lm` models Source: https://easystats.github.io/report/reference/insight/reference/get_weights Provides practical R examples demonstrating how to use `get_weights` with linear models (`lm`). It shows how to extract weights when specified in the model and how `null_as_ones = TRUE` affects the output for models without explicit weights, returning a vector of ones. ```R data(mtcars) set.seed(123) mtcars$weight <- rnorm(nrow(mtcars), 1, .3) # LMs m <- lm(mpg ~ wt + cyl + vs, data = mtcars, weights = weight) get_weights(m) #> [1] 0.8318573 0.9309468 1.4676125 1.0211525 1.0387863 1.5145195 1.1382749 #> [8] 0.6204816 0.7939441 0.8663014 1.3672245 1.1079441 1.1202314 1.0332048 #> [15] 0.8332477 1.5360739 1.1493551 0.4100149 1.2104068 0.8581626 0.6796529 #> [22] 0.9346075 0.6921987 0.7813326 0.8124882 0.4939920 1.2513361 1.0460119 #> [29] 0.6585589 1.3761445 1.1279393 0.9114786 get_weights(lm(mpg ~ wt, data = mtcars), null_as_ones = TRUE) #> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ``` -------------------------------- ### Generate Tabular Reports for Grouped R Dataframes Source: https://easystats.github.io/report/reference/report/articles/report This snippet illustrates how to use 'report_table()' with a 'dplyr' grouped dataframe to produce separate, tabular descriptive statistics for each group. It demonstrates piping the 'iris' dataset, grouped by 'Species', to 'report_table()' to get a structured output of statistics per species. ```R iris %>% group_by(Species) %>% report_table() # Group | Variable | n_Obs | Mean | SD | Median # -------------------------------------------------------- # setosa | Sepal.Length | 50 | 5.01 | 0.35 | 5.00 # setosa | Sepal.Width | 50 | 3.43 | 0.38 | 3.40 # setosa | Petal.Length | 50 | 1.46 | 0.17 | 1.50 # setosa | Petal.Width | 50 | 0.25 | 0.11 | 0.20 # versicolor | Sepal.Length | 50 | 5.94 | 0.52 | 5.90 # versicolor | Sepal.Width | 50 | 2.77 | 0.31 | 2.80 # versicolor | Petal.Length | 50 | 4.26 | 0.47 | 4.35 # versicolor | Petal.Width | 50 | 1.33 | 0.20 | 1.30 # virginica | Sepal.Length | 50 | 6.59 | 0.64 | 6.50 # virginica | Sepal.Width | 50 | 2.97 | 0.32 | 3.00 # virginica | Petal.Length | 50 | 5.55 | 0.55 | 5.55 # virginica | Petal.Width | 50 | 2.03 | 0.27 | 2.00 # # Group | MAD | Min | Max | Skewness | Kurtosis | n_Missing # ----------------------------------------------------------------- # setosa | 0.30 | 4.30 | 5.80 | 0.12 | -0.25 | 0 # setosa | 0.37 | 2.30 | 4.40 | 0.04 | 0.95 | 0 # setosa | 0.15 | 1.00 | 1.90 | 0.11 | 1.02 | 0 # setosa | 0.00 | 0.10 | 0.60 | 1.25 | 1.72 | 0 ``` -------------------------------- ### Install all suggested dependencies for easystats R package Source: https://easystats.github.io/report/reference/easystats Run this command to install all additional packages that easystats sometimes depends on for specific functions. This ensures you benefit from the full easystats experience without any missing dependencies. ```R easystats::install_suggested() ``` -------------------------------- ### Install and Load insight Package in R Source: https://easystats.github.io/report/reference/blog/posts/insight_presentation Demonstrates how to install the 'insight' package from CRAN and load it into the R session for use. This is the first step to utilize the package's functionalities. ```R install.packages("insight") library(insight) ``` -------------------------------- ### Example of `estimate_means` usage with `lm` model Source: https://easystats.github.io/report/reference/modelbased/reference/print.estimate_contrasts Demonstrates how to use the `estimate_means` function with a linear model (`lm`) to estimate means for a specific factor, showing a basic setup for analysis. ```R model <- lm(Petal.Length ~ Species, data = iris) out <- estimate_means(model, "Species") ``` -------------------------------- ### Example of stan_gamm4 model fitting Source: https://easystats.github.io/report/reference/circus/reference/stanreg_gamm4_3 Demonstrates how to fit a generalized additive mixed model using `stan_gamm4`. The example uses the `iris` dataset, adds a categorical variable, and includes a smooth term for 'Petal.Length' and a random intercept for 'Cat1'. The code is wrapped in `if (FALSE)` and `dontrun` for documentation purposes, indicating it's not meant for direct execution without setup. ```R if (FALSE) { # \dontrun{ data <- iris data$Cat1 <- rep(c("X", "X", "Y"), length.out = nrow(data)) stan_gamm4( Sepal.Width ~ Species + s(Petal.Length), random = ~(1 | Cat1), data = data ) # } } ``` -------------------------------- ### R Examples for get_datagrid Function Source: https://easystats.github.io/report/reference/insight/reference/get_datagrid This section provides R code examples demonstrating the usage of `get_datagrid`. It covers creating data grids for single variables (factors and numerics), specifying exact values, controlling the number of points (`length`), adjusting how non-target variables are fixed (`factors`, `numerics`), defining ranges (`range`, `ci`), and using statistical measures like standard deviation for value selection. ```R # Datagrids of variables and dataframes ===================================== data(iris) data(mtcars) # Single variable is of interest; all others are "fixed" ------------------ # Factors, returns all the levels get_datagrid(iris, by = "Species") #> Species Sepal.Length Sepal.Width Petal.Length Petal.Width #> 1 setosa 5.843333 3.057333 3.758 1.199333 #> 2 versicolor 5.843333 3.057333 3.758 1.199333 #> 3 virginica 5.843333 3.057333 3.758 1.199333 # Specify an expression get_datagrid(iris, by = "Species = c('setosa', 'versicolor')") #> Species Sepal.Length Sepal.Width Petal.Length Petal.Width #> 1 setosa 5.843333 3.057333 3.758 1.199333 #> 2 versicolor 5.843333 3.057333 3.758 1.199333 # Numeric variables, default spread length = 10 get_datagrid(iris, by = "Sepal.Length") #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 4.3 3.057333 3.758 1.199333 setosa #> 2 4.7 3.057333 3.758 1.199333 setosa #> 3 5.1 3.057333 3.758 1.199333 setosa #> 4 5.5 3.057333 3.758 1.199333 setosa #> 5 5.9 3.057333 3.758 1.199333 setosa #> 6 6.3 3.057333 3.758 1.199333 setosa #> 7 6.7 3.057333 3.758 1.199333 setosa #> 8 7.1 3.057333 3.758 1.199333 setosa #> 9 7.5 3.057333 3.758 1.199333 setosa #> 10 7.9 3.057333 3.758 1.199333 setosa # change length get_datagrid(iris, by = "Sepal.Length", length = 3) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 4.3 3.057333 3.758 1.199333 setosa #> 2 6.1 3.057333 3.758 1.199333 setosa #> 3 7.9 3.057333 3.758 1.199333 setosa # change non-targets fixing get_datagrid(iris[2:150, ], by = "Sepal.Length", factors = "mode", numerics = "median" ) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 4.3 3 4.4 1.3 versicolor #> 2 4.7 3 4.4 1.3 versicolor #> 3 5.1 3 4.4 1.3 versicolor #> 4 5.5 3 4.4 1.3 versicolor #> 5 5.9 3 4.4 1.3 versicolor #> 6 6.3 3 4.4 1.3 versicolor #> 7 6.7 3 4.4 1.3 versicolor #> 8 7.1 3 4.4 1.3 versicolor #> 9 7.5 3 4.4 1.3 versicolor #> 10 7.9 3 4.4 1.3 versicolor # change min/max of target get_datagrid(iris, by = "Sepal.Length", range = "ci", ci = 0.90) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 4.600 3.057333 3.758 1.199333 setosa #> 2 4.895 3.057333 3.758 1.199333 setosa #> 3 5.190 3.057333 3.758 1.199333 setosa #> 4 5.485 3.057333 3.758 1.199333 setosa #> 5 5.780 3.057333 3.758 1.199333 setosa #> 6 6.075 3.057333 3.758 1.199333 setosa #> 7 6.370 3.057333 3.758 1.199333 setosa #> 8 6.665 3.057333 3.758 1.199333 setosa #> 9 6.960 3.057333 3.758 1.199333 setosa #> 10 7.255 3.057333 3.758 1.199333 setosa # Manually change min/max get_datagrid(iris, by = "Sepal.Length = c(0, 1)") #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 0 3.057333 3.758 1.199333 setosa #> 2 1 3.057333 3.758 1.199333 setosa # -1 SD, mean and +1 SD get_datagrid(iris, by = "Sepal.Length = [sd]") #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.015 3.057333 3.758 1.199333 setosa #> 2 5.843 3.057333 3.758 1.199333 setosa #> 3 6.671 3.057333 3.758 1.199333 setosa ``` -------------------------------- ### R Example: Using get_sigma with a Linear Model Source: https://easystats.github.io/report/reference/insight/reference/get_sigma Demonstrates how to use the `get_sigma` function with a linear model (`lm`) in R to retrieve the residual standard deviation. ```R data(mtcars) m <- lm(mpg ~ wt + cyl + vs, data = mtcars) get_sigma(m) #> [1] 2.608133 #> attr(,"class") #> [1] "insight_aux" "numeric" ``` -------------------------------- ### R clean_names Function Examples Source: https://easystats.github.io/report/reference/insight/reference/clean_names Illustrates practical applications of the `clean_names` function using a `glm` model and demonstrates its behavior compared to `find_variables` from the `lme4` package. ```R counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12) outcome <- as.numeric(gl(3, 1, 9)) treatment <- gl(3, 3) m <- glm(counts ~ log(outcome) + as.factor(treatment), family = poisson()) clean_names(m) #> [1] "counts" "outcome" "treatment" # difference "clean_names()" and "find_variables()" data(cbpp, package = "lme4") m <- lme4::glmer( cbind(incidence, size - incidence) ~ period + (1 | herd), data = cbpp, family = binomial ) clean_names(m) #> [1] "incidence" "size" "period" "herd" find_variables(m) #> $response #> [1] "incidence" "size" #> #> $conditional #> [1] "period" #> #> $random #> [1] "herd" #> find_variables(m, flatten = TRUE) #> [1] "incidence" "size" "period" "herd" ``` -------------------------------- ### R Example: Loading the Report Package Source: https://easystats.github.io/report/reference/report/reference/report.default A simple R code snippet demonstrating how to load the `report` package using the `library()` function, which is a prerequisite for using its functionalities. ```R library(report) ``` -------------------------------- ### Install datawizard R Package Source: https://easystats.github.io/report/reference/datawizard Instructions for installing the `datawizard` R package from CRAN, r-universe, or GitHub for release and development versions. ```R install.packages("datawizard") ``` ```R install.packages("datawizard", repos = "https://easystats.r-universe.dev") ``` ```R remotes::install_github("easystats/datawizard") ``` -------------------------------- ### R Usage Example for get_parameters.gamm Source: https://easystats.github.io/report/reference/insight/reference/get_parameters.gamm Demonstrates the S3 method usage for `get_parameters` when applied to objects of class 'gamm'. This function extracts coefficients from generalized additive models. ```R # S3 method for class 'gamm' get_parameters(x, component = "all", ...) ``` -------------------------------- ### R Example: Displaying model performance with `display` Source: https://easystats.github.io/report/reference/performance/reference/display.performance_model This R code example demonstrates how to use the `display` function to format and print the output of `model_performance` for a linear regression model. It shows the R commands to create a model, calculate its performance, and then display it as a markdown table. ```R model <- lm(mpg ~ wt + cyl, data = mtcars) mp <- model_performance(model) display(mp) #> #> #> |AIC | AICc | BIC | R2 | R2 (adj.) | RMSE | Sigma | #> |:------|:------:|:------:|:----:|:---------:|:----:|:-----:| #> |156.01 | 157.49 | 161.87 | 0.83 | 0.82 | 2.44 | 2.57 | ``` -------------------------------- ### R: Examples of get_intercept with various models Source: https://easystats.github.io/report/reference/insight/reference/get_intercept Demonstrates how to use `get_intercept` with different R model types (`lm`, `lmer`, `gamm4`), showing both successful intercept extraction and cases where no intercept is present. ```R get_intercept(lm(Sepal.Length ~ Petal.Width, data = iris)) #> [1] 4.777629 get_intercept(lm(Sepal.Length ~ 0 + Petal.Width, data = iris)) #> [1] NA get_intercept(lme4::lmer(Sepal.Length ~ Sepal.Width + (1 | Species), data = iris)) #> [1] 3.406167 get_intercept(gamm4::gamm4(Sepal.Length ~ s(Petal.Width), data = iris)) #> [1] 5.843333 ``` -------------------------------- ### Install 'performance' R Package Source: https://easystats.github.io/report/reference/performance Instructions for installing the 'performance' package from CRAN for stable releases or from R-universe for development versions. ```R install.packages("performance") ``` ```R install.packages("performance", repos = "https://easystats.r-universe.dev") ``` -------------------------------- ### Setup Models for Comparison in R Source: https://easystats.github.io/report/reference/parameters/reference/print.parameters_model This R code snippet prepares two linear models using the `iris` dataset. These models can then be used for further analysis or comparison, potentially with custom column layouts or other `easystats` functions. ```R data(iris) lm1 <- lm(Sepal.Length ~ Species, data = iris) lm2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris) ```