Skip to content

R package to quickly perform data analysis and reporting tasks that might otherwise be time intensive

License

Notifications You must be signed in to change notification settings

LukasWallrich/timesaveR

Repository files navigation

timesaveR

R-CMD-check Codecov test coverage Lifecycle:Maturing

This package aims to speed up research projects in social psychology (and related fields). For that, it primarily includes some functions that help lay the groundwork and others that facilitate the reporting of results.

Among others, the package can help with the following:

  • Creating scales, including reverse-coding and reporting their internal consistency,
  • Creating correlation tables in APA style, including descriptive statistics and confidence intervals, and an option to use survey weights, multiple imputation or full-information maximum-likelihood estimation
  • Creating regression tables comparing standardised and non-standardised regression coefficients, and comparing the F-change between two nested models
  • Formatting numbers for statistical reporting, including rounding with trailing zeros, or displaying numbers as p-values or as confidence intervals
  • Data entry and transfer, for quick interactive use. This includes splitting clipboard content into vectors, converting tibbles to tribble code, or obtaining nicely formatted code and results to paste into another application

Why use this package?

There are many packages that support data analysis and reporting. For instance, the psych package offers functions to create scales, while the modelsummary package offers options to create customisable tables in a wide variety of output format. They power many of the functions offered here ‘under the hood.’

apa and papaja are two packages that directly support the reporting of results in APA style - they can complement this package well. However, none of the existing offered quite what we needed. This package

  • takes an end-to-end view of the data analysis process, streamlining time-consuming steps at various stages
  • offers analysis templates that make it easy to get started, particularly for R novices,
  • prioritises publication-readiness and good reporting practices over customisability in creating tables and charts
  • integrates with the tidyverse by supporting tidy evaluation and returning tibbles where possible

Installation

You can install timesaveR from GitHub with the command below. If you do not have the remotes-package installed, run install.packages("remote") first.

remotes::install_github('lukaswallrich/timesaveR')

Get started

There are many functions in the package, and we will create vignettes detailing various use cases. However, the following can give you an initial flavor. The examples use data from the European Social Survey Wave 7 (2014). Here, I ignore survey weights. However, the package offers similar functions for analysing weighted survey data, which are explained in the survey data vignette.

Load the package

(I also load dplyr since that is the recommended usage - of course, there are base R alternatives for all of the steps.)

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(timesaveR)
#> Note re timesaveR: Many functions in this package are alpha-versions - please treat results with care and report bugs and desired features.

Create scales

Let’s create scales for health behaviours and depressive symptoms, each including some reverse coding.

scales <- list(
  depression = c("fltdpr", "flteeff", "slprl", "wrhpp", "fltlnl", 
                 "enjlf", "fltsd", "cldgng"),
  healthy_eating = c("etfruit", "eatveg")
  )
  
scales_reverse <- list(
  depression = c("wrhpp", "enjlf"),
  healthy_eating = c("etfruit", "eatveg")
)

scales <- make_scales(ess_health, items = scales, reversed = scales_reverse)
#> The following scales will be calculated with specified reverse coding: depression, healthy_eating

#Check descriptives, including reliability
scales$descriptives
#> # A tibble: 2 × 10
#>   Scale      n_items reliability reliability_method  mean    SD reversed rev_min
#>   <chr>        <int>       <dbl> <chr>              <dbl> <dbl> <chr>      <dbl>
#> 1 depression       8       0.802 cronbachs_alpha     1.67 0.484 wrhpp e…       1
#> 2 healthy_e…       2       0.658 spearman_brown      4.97 1.11  etfruit…       1
#> # ℹ 2 more variables: rev_max <dbl>, text <chr>

#Add scale scores to dataset
ess_health <- bind_cols(ess_health, scales$scores)

Report correlations and descriptive statistics

Next, we are often interested in descriptive statistics, variable distributions and correlations.

ess_health %>% select(agea, health, depression, healthy_eating) %>% 
    cor_matrix() %>% report_cor_table()
<style>#uuaxumjvmz table { font-family: times, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

#uuaxumjvmz thead, #uuaxumjvmz tbody, #uuaxumjvmz tfoot, #uuaxumjvmz tr, #uuaxumjvmz td, #uuaxumjvmz th { border-style: none; }

#uuaxumjvmz p { margin: 0; padding: 0; }

#uuaxumjvmz .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 12px; font-weight: normal; font-style: none; background-color: #FFFFFF; width: auto; border-top-style: none; border-top-width: 2px; border-top-color: #FFFFFF; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }

#uuaxumjvmz .gt_caption { padding-top: 4px; padding-bottom: 4px; }

#uuaxumjvmz .gt_title { color: #333333; font-size: 12px; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }

#uuaxumjvmz .gt_subtitle { color: #333333; font-size: 12px; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }

#uuaxumjvmz .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }

#uuaxumjvmz .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #000000; }

#uuaxumjvmz .gt_col_headings { border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }

#uuaxumjvmz .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }

#uuaxumjvmz .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }

#uuaxumjvmz .gt_column_spanner_outer:first-child { padding-left: 0; }

#uuaxumjvmz .gt_column_spanner_outer:last-child { padding-right: 0; }

#uuaxumjvmz .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }

#uuaxumjvmz .gt_spanner_row { border-bottom-style: hidden; }

#uuaxumjvmz .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }

#uuaxumjvmz .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }

#uuaxumjvmz .gt_from_md > :first-child { margin-top: 0; }

#uuaxumjvmz .gt_from_md > :last-child { margin-bottom: 0; }

#uuaxumjvmz .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: none; border-top-width: 1px; border-top-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }

#uuaxumjvmz .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }

#uuaxumjvmz .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }

#uuaxumjvmz .gt_row_group_first td { border-top-width: 2px; }

#uuaxumjvmz .gt_row_group_first th { border-top-width: 2px; }

#uuaxumjvmz .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }

#uuaxumjvmz .gt_first_summary_row { border-top-style: none; border-top-color: #D3D3D3; }

#uuaxumjvmz .gt_first_summary_row.thick { border-top-width: 2px; }

#uuaxumjvmz .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }

#uuaxumjvmz .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }

#uuaxumjvmz .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: none; border-top-width: 6px; border-top-color: #D3D3D3; }

#uuaxumjvmz .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }

#uuaxumjvmz .gt_striped { background-color: rgba(128, 128, 128, 0.05); }

#uuaxumjvmz .gt_table_body { border-top-style: solid; border-top-width: 1px; border-top-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; }

#uuaxumjvmz .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }

#uuaxumjvmz .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }

#uuaxumjvmz .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }

#uuaxumjvmz .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }

#uuaxumjvmz .gt_left { text-align: left; }

#uuaxumjvmz .gt_center { text-align: center; }

#uuaxumjvmz .gt_right { text-align: right; font-variant-numeric: tabular-nums; }

#uuaxumjvmz .gt_font_normal { font-weight: normal; }

#uuaxumjvmz .gt_font_bold { font-weight: bold; }

#uuaxumjvmz .gt_font_italic { font-style: italic; }

#uuaxumjvmz .gt_super { font-size: 65%; }

#uuaxumjvmz .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }

#uuaxumjvmz .gt_asterisk { font-size: 100%; vertical-align: 0; }

#uuaxumjvmz .gt_indent_1 { text-indent: 5px; }

#uuaxumjvmz .gt_indent_2 { text-indent: 10px; }

#uuaxumjvmz .gt_indent_3 { text-indent: 15px; }

#uuaxumjvmz .gt_indent_4 { text-indent: 20px; }

#uuaxumjvmz .gt_indent_5 { text-indent: 25px; } </style>

<tr class="gt_col_headings">
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="Variable">Variable</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="&lt;em&gt;M (SD)&lt;/em&gt;"><em>M (SD)</em></th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="1">1</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="2">2</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="3">3</th>
</tr>
  1. agea

50.61 (18.51)




  1. health

2.26 (0.92)

.28 ***
[0.25, 0.30]



  1. depression

1.67 (0.48)

.03 *
[0.00, 0.05]

.42 ***
[0.40, 0.44]


  1. healthy_eating

4.97 (1.11)

.17 ***
[0.15, 0.19]

-.09 ***
[-0.11, -0.07]

-.13 ***
[-0.15, -0.10]

M and SD are used to represent mean and standard deviation, respectively. Values in square brackets indicate the 95% confidence interval for each correlation.
p < .1, * p < .05, ** p < .01, *** p < .001

#It is often helpful to rename variables in this step #Use get_rename_tribbles(ess_health) to get most of this code var_renames <- tibble::tribble( ~old, ~new,
"agea", "Age",
"health", "Poor health", "depression", "Depression", "healthy_eating", "Healthy eating", )

#A rename tibble or vector automatically only selects the variables included into it ess_health %>% cor_matrix(var_names = var_renames) %>% report_cor_table()

<style>#qvuoajfxcb table { font-family: times, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

#qvuoajfxcb thead, #qvuoajfxcb tbody, #qvuoajfxcb tfoot, #qvuoajfxcb tr, #qvuoajfxcb td, #qvuoajfxcb th { border-style: none; }

#qvuoajfxcb p { margin: 0; padding: 0; }

#qvuoajfxcb .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 12px; font-weight: normal; font-style: none; background-color: #FFFFFF; width: auto; border-top-style: none; border-top-width: 2px; border-top-color: #FFFFFF; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }

#qvuoajfxcb .gt_caption { padding-top: 4px; padding-bottom: 4px; }

#qvuoajfxcb .gt_title { color: #333333; font-size: 12px; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }

#qvuoajfxcb .gt_subtitle { color: #333333; font-size: 12px; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }

#qvuoajfxcb .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }

#qvuoajfxcb .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #000000; }

#qvuoajfxcb .gt_col_headings { border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }

#qvuoajfxcb .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }

#qvuoajfxcb .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }

#qvuoajfxcb .gt_column_spanner_outer:first-child { padding-left: 0; }

#qvuoajfxcb .gt_column_spanner_outer:last-child { padding-right: 0; }

#qvuoajfxcb .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }

#qvuoajfxcb .gt_spanner_row { border-bottom-style: hidden; }

#qvuoajfxcb .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }

#qvuoajfxcb .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }

#qvuoajfxcb .gt_from_md > :first-child { margin-top: 0; }

#qvuoajfxcb .gt_from_md > :last-child { margin-bottom: 0; }

#qvuoajfxcb .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: none; border-top-width: 1px; border-top-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }

#qvuoajfxcb .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }

#qvuoajfxcb .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }

#qvuoajfxcb .gt_row_group_first td { border-top-width: 2px; }

#qvuoajfxcb .gt_row_group_first th { border-top-width: 2px; }

#qvuoajfxcb .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }

#qvuoajfxcb .gt_first_summary_row { border-top-style: none; border-top-color: #D3D3D3; }

#qvuoajfxcb .gt_first_summary_row.thick { border-top-width: 2px; }

#qvuoajfxcb .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }

#qvuoajfxcb .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }

#qvuoajfxcb .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: none; border-top-width: 6px; border-top-color: #D3D3D3; }

#qvuoajfxcb .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }

#qvuoajfxcb .gt_striped { background-color: rgba(128, 128, 128, 0.05); }

#qvuoajfxcb .gt_table_body { border-top-style: solid; border-top-width: 1px; border-top-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; }

#qvuoajfxcb .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }

#qvuoajfxcb .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }

#qvuoajfxcb .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }

#qvuoajfxcb .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }

#qvuoajfxcb .gt_left { text-align: left; }

#qvuoajfxcb .gt_center { text-align: center; }

#qvuoajfxcb .gt_right { text-align: right; font-variant-numeric: tabular-nums; }

#qvuoajfxcb .gt_font_normal { font-weight: normal; }

#qvuoajfxcb .gt_font_bold { font-weight: bold; }

#qvuoajfxcb .gt_font_italic { font-style: italic; }

#qvuoajfxcb .gt_super { font-size: 65%; }

#qvuoajfxcb .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }

#qvuoajfxcb .gt_asterisk { font-size: 100%; vertical-align: 0; }

#qvuoajfxcb .gt_indent_1 { text-indent: 5px; }

#qvuoajfxcb .gt_indent_2 { text-indent: 10px; }

#qvuoajfxcb .gt_indent_3 { text-indent: 15px; }

#qvuoajfxcb .gt_indent_4 { text-indent: 20px; }

#qvuoajfxcb .gt_indent_5 { text-indent: 25px; } </style>

<tr class="gt_col_headings">
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="Variable">Variable</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="&lt;em&gt;M (SD)&lt;/em&gt;"><em>M (SD)</em></th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="1">1</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="2">2</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="3">3</th>
</tr>
  1. Age

50.61 (18.51)




  1. Poor health

2.26 (0.92)

.28 ***
[0.25, 0.30]



  1. Depression

1.67 (0.48)

.03 *
[0.00, 0.05]

.42 ***
[0.40, 0.44]


  1. Healthy eating

4.97 (1.11)

.17 ***
[0.15, 0.19]

-.09 ***
[-0.11, -0.07]

-.13 ***
[-0.15, -0.10]

M and SD are used to represent mean and standard deviation, respectively. Values in square brackets indicate the 95% confidence interval for each correlation.
p < .1, * p < .05, ** p < .01, *** p < .001

#Often, it is also interesting to include variable distributions ess_health %>% cor_matrix(var_names = var_renames) %>% report_cor_table(add_distributions = TRUE, data = ess_health)

<style>#actthsbpbh table { font-family: times, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

#actthsbpbh thead, #actthsbpbh tbody, #actthsbpbh tfoot, #actthsbpbh tr, #actthsbpbh td, #actthsbpbh th { border-style: none; }

#actthsbpbh p { margin: 0; padding: 0; }

#actthsbpbh .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 12px; font-weight: normal; font-style: none; background-color: #FFFFFF; width: auto; border-top-style: none; border-top-width: 2px; border-top-color: #FFFFFF; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; }

#actthsbpbh .gt_caption { padding-top: 4px; padding-bottom: 4px; }

#actthsbpbh .gt_title { color: #333333; font-size: 12px; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; }

#actthsbpbh .gt_subtitle { color: #333333; font-size: 12px; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; }

#actthsbpbh .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }

#actthsbpbh .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #000000; }

#actthsbpbh .gt_col_headings { border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; }

#actthsbpbh .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; }

#actthsbpbh .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; }

#actthsbpbh .gt_column_spanner_outer:first-child { padding-left: 0; }

#actthsbpbh .gt_column_spanner_outer:last-child { padding-right: 0; }

#actthsbpbh .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; }

#actthsbpbh .gt_spanner_row { border-bottom-style: hidden; }

#actthsbpbh .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; }

#actthsbpbh .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; }

#actthsbpbh .gt_from_md > :first-child { margin-top: 0; }

#actthsbpbh .gt_from_md > :last-child { margin-bottom: 0; }

#actthsbpbh .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: none; border-top-width: 1px; border-top-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; }

#actthsbpbh .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; }

#actthsbpbh .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; }

#actthsbpbh .gt_row_group_first td { border-top-width: 2px; }

#actthsbpbh .gt_row_group_first th { border-top-width: 2px; }

#actthsbpbh .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }

#actthsbpbh .gt_first_summary_row { border-top-style: none; border-top-color: #D3D3D3; }

#actthsbpbh .gt_first_summary_row.thick { border-top-width: 2px; }

#actthsbpbh .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; }

#actthsbpbh .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; }

#actthsbpbh .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: none; border-top-width: 6px; border-top-color: #D3D3D3; }

#actthsbpbh .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 6px; border-bottom-color: #D3D3D3; }

#actthsbpbh .gt_striped { background-color: rgba(128, 128, 128, 0.05); }

#actthsbpbh .gt_table_body { border-top-style: solid; border-top-width: 1px; border-top-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; }

#actthsbpbh .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }

#actthsbpbh .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }

#actthsbpbh .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; }

#actthsbpbh .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; }

#actthsbpbh .gt_left { text-align: left; }

#actthsbpbh .gt_center { text-align: center; }

#actthsbpbh .gt_right { text-align: right; font-variant-numeric: tabular-nums; }

#actthsbpbh .gt_font_normal { font-weight: normal; }

#actthsbpbh .gt_font_bold { font-weight: bold; }

#actthsbpbh .gt_font_italic { font-style: italic; }

#actthsbpbh .gt_super { font-size: 65%; }

#actthsbpbh .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; }

#actthsbpbh .gt_asterisk { font-size: 100%; vertical-align: 0; }

#actthsbpbh .gt_indent_1 { text-indent: 5px; }

#actthsbpbh .gt_indent_2 { text-indent: 10px; }

#actthsbpbh .gt_indent_3 { text-indent: 15px; }

#actthsbpbh .gt_indent_4 { text-indent: 20px; }

#actthsbpbh .gt_indent_5 { text-indent: 25px; } </style>

<tr class="gt_col_headings">
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="Variable">Variable</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="&lt;em&gt;M (SD)&lt;/em&gt;"><em>M (SD)</em></th>
  <th class="gt_col_heading gt_columns_bottom_border gt_right" rowspan="1" colspan="1" scope="col" id="Distributions">Distributions</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="1">1</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="2">2</th>
  <th class="gt_col_heading gt_columns_bottom_border gt_left" rowspan="1" colspan="1" scope="col" id="3">3</th>
</tr>
  1. Age

50.61 (18.51)




  1. Poor health

2.26 (0.92)

.28 ***
[0.25, 0.30]



  1. Depression

1.67 (0.48)

.03 *
[0.00, 0.05]

.42 ***
[0.40, 0.44]


  1. Healthy eating

4.97 (1.11)

.17 ***
[0.15, 0.19]

-.09 ***
[-0.11, -0.07]

-.13 ***
[-0.15, -0.10]

M and SD are used to represent mean and standard deviation, respectively. Values in square brackets indicate the 95% confidence interval for each correlation.
p < .1, * p < .05, ** p < .01, *** p < .001

Describe categorical variables and their relation with an outcome

Often, we are also interested in how the means of an outcome variable differ between different groups. It can be fiddly to get these tables and the pairwise significance tests done, but this function does it in a breeze.

# Start with this in the console - that gets you 80% of the tribbles below.
# get_rename_tribbles(ess_health, gndr, cntry)

var_renames <- tribble(
    ~old,     ~new,     
    "gndr",   "Gender",  
    "cntry",  "Country"
)

level_renames <- tribble(
    ~var,     ~level_old, ~level_new, 
    "gndr",   "1",        "male",       
    "gndr",   "2",        "female",       
    "cntry",  "DE",       "Germany",      
    "cntry",  "FR",       "France",      
    "cntry",  "GB",       "UK"
)

report_cat_vars(ess_health, health, gndr, cntry, var_names = var_renames, 
              level_names = level_renames)
<style>body{background-color:white;}</style>
<style>#ypnxlklxpy table { font-family: times, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } #ypnxlklxpy thead, #ypnxlklxpy tbody, #ypnxlklxpy tfoot, #ypnxlklxpy tr, #ypnxlklxpy td, #ypnxlklxpy th { border-style: none; } #ypnxlklxpy p { margin: 0; padding: 0; } #ypnxlklxpy .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 12px; font-weight: normal; font-style: none; background-color: #FFFFFF; width: auto; border-top-style: none; border-top-width: 2px; border-top-color: #FFFFFF; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; } #ypnxlklxpy .gt_caption { padding-top: 4px; padding-bottom: 4px; } #ypnxlklxpy .gt_title { color: #333333; font-size: 12px; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; } #ypnxlklxpy .gt_subtitle { color: #333333; font-size: 12px; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; } #ypnxlklxpy .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #ypnxlklxpy .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #000000; } #ypnxlklxpy .gt_col_headings { border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #ypnxlklxpy .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; } #ypnxlklxpy .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; } #ypnxlklxpy .gt_column_spanner_outer:first-child { padding-left: 0; } #ypnxlklxpy .gt_column_spanner_outer:last-child { padding-right: 0; } #ypnxlklxpy .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; } #ypnxlklxpy .gt_spanner_row { border-bottom-style: hidden; } #ypnxlklxpy .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; } #ypnxlklxpy .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; } #ypnxlklxpy .gt_from_md > :first-child { margin-top: 0; } #ypnxlklxpy .gt_from_md > :last-child { margin-bottom: 0; } #ypnxlklxpy .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: none; border-top-width: 1px; border-top-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; } #ypnxlklxpy .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; } #ypnxlklxpy .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; } #ypnxlklxpy .gt_row_group_first td { border-top-width: 2px; } #ypnxlklxpy .gt_row_group_first th { border-top-width: 2px; } #ypnxlklxpy .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #ypnxlklxpy .gt_first_summary_row { border-top-style: none; border-top-color: #D3D3D3; } #ypnxlklxpy .gt_first_summary_row.thick { border-top-width: 2px; } #ypnxlklxpy .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #ypnxlklxpy .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #ypnxlklxpy .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: none; border-top-width: 6px; border-top-color: #D3D3D3; } #ypnxlklxpy .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 6px; border-bottom-color: #D3D3D3; } #ypnxlklxpy .gt_striped { background-color: rgba(128, 128, 128, 0.05); } #ypnxlklxpy .gt_table_body { border-top-style: solid; border-top-width: 1px; border-top-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; } #ypnxlklxpy .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #ypnxlklxpy .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #ypnxlklxpy .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #ypnxlklxpy .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #ypnxlklxpy .gt_left { text-align: left; } #ypnxlklxpy .gt_center { text-align: center; } #ypnxlklxpy .gt_right { text-align: right; font-variant-numeric: tabular-nums; } #ypnxlklxpy .gt_font_normal { font-weight: normal; } #ypnxlklxpy .gt_font_bold { font-weight: bold; } #ypnxlklxpy .gt_font_italic { font-style: italic; } #ypnxlklxpy .gt_super { font-size: 65%; } #ypnxlklxpy .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; } #ypnxlklxpy .gt_asterisk { font-size: 100%; vertical-align: 0; } #ypnxlklxpy .gt_indent_1 { text-indent: 5px; } #ypnxlklxpy .gt_indent_2 { text-indent: 10px; } #ypnxlklxpy .gt_indent_3 { text-indent: 15px; } #ypnxlklxpy .gt_indent_4 { text-indent: 20px; } #ypnxlklxpy .gt_indent_5 { text-indent: 25px; } </style>
N Share M (SD)
Gender

male

3482

48.2%

2.23 (0.90) a

female

3744

51.8%

2.30 (0.93) b

Country

Germany

3045

42.1%

2.34 (0.88) a

France

1917

26.5%

2.29 (0.89) a

UK

2264

31.3%

2.14 (0.97) b

M and SD are used to represent mean and standard deviation for health for that group, respectively.
Within each variable, the means of groups with different superscripts differ with p \< .05
(p-values were adjusted using the Holm-method.)

Report regression models with standardized coefficients

In psychology, it is often expected that regression models are reported with both unstandardised (B) and standardized (beta) coefficients. This can be fiddly as separate tables will contain too much redundant information. The functions below easily run a model with standardised variables and create a publication-ready table.

ess_health$gndr <- factor(ess_health$gndr)

#Standard lm model
mod1 <- lm(depression ~ agea + gndr + health + cntry, ess_health)

#Model with standardised coefficients

mod2 <- lm_std(depression ~ agea + gndr + health + cntry, ess_health)

report_lm_with_std(mod1, mod2)
<style>body{background-color:white;}</style>
<style>#wetzcqixyw table { font-family: times, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } #wetzcqixyw thead, #wetzcqixyw tbody, #wetzcqixyw tfoot, #wetzcqixyw tr, #wetzcqixyw td, #wetzcqixyw th { border-style: none; } #wetzcqixyw p { margin: 0; padding: 0; } #wetzcqixyw .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 12px; font-weight: normal; font-style: none; background-color: #FFFFFF; width: auto; border-top-style: none; border-top-width: 2px; border-top-color: #FFFFFF; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; } #wetzcqixyw .gt_caption { padding-top: 4px; padding-bottom: 4px; } #wetzcqixyw .gt_title { color: #333333; font-size: 12px; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; } #wetzcqixyw .gt_subtitle { color: #333333; font-size: 12px; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; } #wetzcqixyw .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #wetzcqixyw .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #000000; } #wetzcqixyw .gt_col_headings { border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #wetzcqixyw .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; } #wetzcqixyw .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; } #wetzcqixyw .gt_column_spanner_outer:first-child { padding-left: 0; } #wetzcqixyw .gt_column_spanner_outer:last-child { padding-right: 0; } #wetzcqixyw .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; } #wetzcqixyw .gt_spanner_row { border-bottom-style: hidden; } #wetzcqixyw .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; } #wetzcqixyw .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; } #wetzcqixyw .gt_from_md > :first-child { margin-top: 0; } #wetzcqixyw .gt_from_md > :last-child { margin-bottom: 0; } #wetzcqixyw .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: none; border-top-width: 1px; border-top-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; } #wetzcqixyw .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; } #wetzcqixyw .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; } #wetzcqixyw .gt_row_group_first td { border-top-width: 2px; } #wetzcqixyw .gt_row_group_first th { border-top-width: 2px; } #wetzcqixyw .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #wetzcqixyw .gt_first_summary_row { border-top-style: none; border-top-color: #D3D3D3; } #wetzcqixyw .gt_first_summary_row.thick { border-top-width: 2px; } #wetzcqixyw .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #wetzcqixyw .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #wetzcqixyw .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: none; border-top-width: 6px; border-top-color: #D3D3D3; } #wetzcqixyw .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 6px; border-bottom-color: #D3D3D3; } #wetzcqixyw .gt_striped { background-color: rgba(128, 128, 128, 0.05); } #wetzcqixyw .gt_table_body { border-top-style: solid; border-top-width: 1px; border-top-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; } #wetzcqixyw .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #wetzcqixyw .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #wetzcqixyw .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #wetzcqixyw .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #wetzcqixyw .gt_left { text-align: left; } #wetzcqixyw .gt_center { text-align: center; } #wetzcqixyw .gt_right { text-align: right; font-variant-numeric: tabular-nums; } #wetzcqixyw .gt_font_normal { font-weight: normal; } #wetzcqixyw .gt_font_bold { font-weight: bold; } #wetzcqixyw .gt_font_italic { font-style: italic; } #wetzcqixyw .gt_super { font-size: 65%; } #wetzcqixyw .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; } #wetzcqixyw .gt_asterisk { font-size: 100%; vertical-align: 0; } #wetzcqixyw .gt_indent_1 { text-indent: 5px; } #wetzcqixyw .gt_indent_2 { text-indent: 10px; } #wetzcqixyw .gt_indent_3 { text-indent: 15px; } #wetzcqixyw .gt_indent_4 { text-indent: 20px; } #wetzcqixyw .gt_indent_5 { text-indent: 25px; } </style>
B (SE) β \[95% CI\]

(Intercept)

1.20 (0.02)\*\*\*

-0.14 \[-0.18, -0.10\]

agea

-0.00 (0.00)\*\*\*

-0.10 \[-0.12, -0.08\]

gndr2

0.12 (0.01)\*\*\*

0.24 \[0.20, 0.28\]

health

0.23 (0.01)\*\*\*

0.44 \[0.42, 0.47\]

cntryFR

-0.01 (0.01)   

-0.02 \[-0.08, 0.03\]

cntryGB

0.04 (0.01)\*\* 

0.08 \[0.03, 0.13\]

N 7171
R2 .20
F-tests

F(5, 7165) = 358.25, p \< .001

Given that dummy variables lose their interpretability when standardized (Fox, 2015), β for dummy variables are semi-standardized, indicating the impact of that dummy on the standardized outcome variable.
p \< .1, \* p \< .05, \*\* p \< .01, \*\*\* p \< .001
#Often the coefficients should be renamed - get_coef_rename_tribble(mod1) 
#is the starting point. In that, markdown formatting can be used.

coef_names <- tribble(
  ~old,           ~new,           
   "(Intercept)",  "*(Intercept)*", 
   "agea",         "Age",        
   "gndr2",        "Gender *(female)*",       
   "health",       "Poor health",      
   "cntryFR",      "France *(vs DE)*",     
   "cntryGB",      "UK *(vs DE)*"
)

report_lm_with_std(mod1, mod2, coef_renames = coef_names)
<style>body{background-color:white;}</style>
<style>#qnkfogpjwm table { font-family: times, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } #qnkfogpjwm thead, #qnkfogpjwm tbody, #qnkfogpjwm tfoot, #qnkfogpjwm tr, #qnkfogpjwm td, #qnkfogpjwm th { border-style: none; } #qnkfogpjwm p { margin: 0; padding: 0; } #qnkfogpjwm .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 12px; font-weight: normal; font-style: none; background-color: #FFFFFF; width: auto; border-top-style: none; border-top-width: 2px; border-top-color: #FFFFFF; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; } #qnkfogpjwm .gt_caption { padding-top: 4px; padding-bottom: 4px; } #qnkfogpjwm .gt_title { color: #333333; font-size: 12px; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; } #qnkfogpjwm .gt_subtitle { color: #333333; font-size: 12px; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; } #qnkfogpjwm .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #qnkfogpjwm .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #000000; } #qnkfogpjwm .gt_col_headings { border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #qnkfogpjwm .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; } #qnkfogpjwm .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; } #qnkfogpjwm .gt_column_spanner_outer:first-child { padding-left: 0; } #qnkfogpjwm .gt_column_spanner_outer:last-child { padding-right: 0; } #qnkfogpjwm .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; } #qnkfogpjwm .gt_spanner_row { border-bottom-style: hidden; } #qnkfogpjwm .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; } #qnkfogpjwm .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; } #qnkfogpjwm .gt_from_md > :first-child { margin-top: 0; } #qnkfogpjwm .gt_from_md > :last-child { margin-bottom: 0; } #qnkfogpjwm .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: none; border-top-width: 1px; border-top-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; } #qnkfogpjwm .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; } #qnkfogpjwm .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; } #qnkfogpjwm .gt_row_group_first td { border-top-width: 2px; } #qnkfogpjwm .gt_row_group_first th { border-top-width: 2px; } #qnkfogpjwm .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #qnkfogpjwm .gt_first_summary_row { border-top-style: none; border-top-color: #D3D3D3; } #qnkfogpjwm .gt_first_summary_row.thick { border-top-width: 2px; } #qnkfogpjwm .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #qnkfogpjwm .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #qnkfogpjwm .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: none; border-top-width: 6px; border-top-color: #D3D3D3; } #qnkfogpjwm .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 6px; border-bottom-color: #D3D3D3; } #qnkfogpjwm .gt_striped { background-color: rgba(128, 128, 128, 0.05); } #qnkfogpjwm .gt_table_body { border-top-style: solid; border-top-width: 1px; border-top-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; } #qnkfogpjwm .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #qnkfogpjwm .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #qnkfogpjwm .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #qnkfogpjwm .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #qnkfogpjwm .gt_left { text-align: left; } #qnkfogpjwm .gt_center { text-align: center; } #qnkfogpjwm .gt_right { text-align: right; font-variant-numeric: tabular-nums; } #qnkfogpjwm .gt_font_normal { font-weight: normal; } #qnkfogpjwm .gt_font_bold { font-weight: bold; } #qnkfogpjwm .gt_font_italic { font-style: italic; } #qnkfogpjwm .gt_super { font-size: 65%; } #qnkfogpjwm .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; } #qnkfogpjwm .gt_asterisk { font-size: 100%; vertical-align: 0; } #qnkfogpjwm .gt_indent_1 { text-indent: 5px; } #qnkfogpjwm .gt_indent_2 { text-indent: 10px; } #qnkfogpjwm .gt_indent_3 { text-indent: 15px; } #qnkfogpjwm .gt_indent_4 { text-indent: 20px; } #qnkfogpjwm .gt_indent_5 { text-indent: 25px; } </style>
B (SE) β \[95% CI\]

(Intercept)

1.20 (0.02)\*\*\*

-0.14 \[-0.18, -0.10\]

Age

-0.00 (0.00)\*\*\*

-0.10 \[-0.12, -0.08\]

Gender (female)

0.12 (0.01)\*\*\*

0.24 \[0.20, 0.28\]

Poor health

0.23 (0.01)\*\*\*

0.44 \[0.42, 0.47\]

France (vs DE)

-0.01 (0.01)   

-0.02 \[-0.08, 0.03\]

UK (vs DE)

0.04 (0.01)\*\* 

0.08 \[0.03, 0.13\]

N 7171
R2 .20
F-tests

F(5, 7165) = 358.25, p \< .001

Given that dummy variables lose their interpretability when standardized (Fox, 2015), β for dummy variables are semi-standardized, indicating the impact of that dummy on the standardized outcome variable.
p \< .1, \* p \< .05, \*\* p \< .01, \*\*\* p \< .001
#You can also easily display multiple nested models side-by-side and get the
#F-change significance test. For that, all models need to be fit on the same
#dataset, so that I will drop all missing data.

mod1 <- lm(depression ~ agea + gndr + health + cntry, tidyr::drop_na(ess_health))
mod2 <- lm_std(depression ~ agea + gndr + health + cntry, tidyr::drop_na(ess_health))


mod3 <- lm(depression ~ agea * gndr + eisced + health + cntry, tidyr::drop_na(ess_health))
mod4 <- lm_std(depression ~ agea * gndr + eisced + health + cntry, tidyr::drop_na(ess_health))

coef_names <- tribble(
  ~old,           ~new,           
   "(Intercept)",  "*(Intercept)*", 
   "agea",         "Age",        
   "gndr2",        "Gender *(female)*",       
   "health",       "Poor health",      
   "cntryFR",      "France *(vs DE)*",     
   "cntryGB",      "UK *(vs DE)*",
   "eisced",       "Education",
   "agea:gndr2",   "Age x Female",
)

report_lm_with_std(mod = list(mod1, mod3), mod_std = list(mod2, mod4),
                   coef_renames = coef_names, R2_change = TRUE)
#> Warning: Automatic coercion from double to character was deprecated in purrr 1.0.0.
#> ℹ Please use an explicit call to `as.character()` within `map_chr()` instead.
#> ℹ The deprecated feature was likely used in the timesaveR package.
#>   Please report the issue at
#>   <https://github.com/LukasWallrich/timesaveR/issues>.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
<style>body{background-color:white;}</style>
<style>#qfvwbyqenp table { font-family: times, system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } #qfvwbyqenp thead, #qfvwbyqenp tbody, #qfvwbyqenp tfoot, #qfvwbyqenp tr, #qfvwbyqenp td, #qfvwbyqenp th { border-style: none; } #qfvwbyqenp p { margin: 0; padding: 0; } #qfvwbyqenp .gt_table { display: table; border-collapse: collapse; line-height: normal; margin-left: auto; margin-right: auto; color: #333333; font-size: 12px; font-weight: normal; font-style: none; background-color: #FFFFFF; width: auto; border-top-style: none; border-top-width: 2px; border-top-color: #FFFFFF; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #A8A8A8; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; } #qfvwbyqenp .gt_caption { padding-top: 4px; padding-bottom: 4px; } #qfvwbyqenp .gt_title { color: #333333; font-size: 12px; font-weight: initial; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; border-bottom-color: #FFFFFF; border-bottom-width: 0; } #qfvwbyqenp .gt_subtitle { color: #333333; font-size: 12px; font-weight: initial; padding-top: 3px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; border-top-color: #FFFFFF; border-top-width: 0; } #qfvwbyqenp .gt_heading { background-color: #FFFFFF; text-align: center; border-bottom-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #qfvwbyqenp .gt_bottom_border { border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: #000000; } #qfvwbyqenp .gt_col_headings { border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; } #qfvwbyqenp .gt_col_heading { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: bottom; padding-top: 5px; padding-bottom: 6px; padding-left: 5px; padding-right: 5px; overflow-x: hidden; } #qfvwbyqenp .gt_column_spanner_outer { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: normal; text-transform: inherit; padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 4px; } #qfvwbyqenp .gt_column_spanner_outer:first-child { padding-left: 0; } #qfvwbyqenp .gt_column_spanner_outer:last-child { padding-right: 0; } #qfvwbyqenp .gt_column_spanner { border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; vertical-align: bottom; padding-top: 5px; padding-bottom: 5px; overflow-x: hidden; display: inline-block; width: 100%; } #qfvwbyqenp .gt_spanner_row { border-bottom-style: hidden; } #qfvwbyqenp .gt_group_heading { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; text-align: left; } #qfvwbyqenp .gt_empty_group_heading { padding: 0.5px; color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; border-top-style: none; border-top-width: 2px; border-top-color: #D3D3D3; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; vertical-align: middle; } #qfvwbyqenp .gt_from_md > :first-child { margin-top: 0; } #qfvwbyqenp .gt_from_md > :last-child { margin-bottom: 0; } #qfvwbyqenp .gt_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; margin: 10px; border-top-style: none; border-top-width: 1px; border-top-color: #FFFFFF; border-left-style: none; border-left-width: 1px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 1px; border-right-color: #D3D3D3; vertical-align: middle; overflow-x: hidden; } #qfvwbyqenp .gt_stub { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; } #qfvwbyqenp .gt_stub_row_group { color: #333333; background-color: #FFFFFF; font-size: 100%; font-weight: initial; text-transform: inherit; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; padding-left: 5px; padding-right: 5px; vertical-align: top; } #qfvwbyqenp .gt_row_group_first td { border-top-width: 2px; } #qfvwbyqenp .gt_row_group_first th { border-top-width: 2px; } #qfvwbyqenp .gt_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #qfvwbyqenp .gt_first_summary_row { border-top-style: none; border-top-color: #D3D3D3; } #qfvwbyqenp .gt_first_summary_row.thick { border-top-width: 2px; } #qfvwbyqenp .gt_last_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; } #qfvwbyqenp .gt_grand_summary_row { color: #333333; background-color: #FFFFFF; text-transform: inherit; padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; } #qfvwbyqenp .gt_first_grand_summary_row { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-top-style: none; border-top-width: 6px; border-top-color: #D3D3D3; } #qfvwbyqenp .gt_last_grand_summary_row_top { padding-top: 8px; padding-bottom: 8px; padding-left: 5px; padding-right: 5px; border-bottom-style: none; border-bottom-width: 6px; border-bottom-color: #D3D3D3; } #qfvwbyqenp .gt_striped { background-color: rgba(128, 128, 128, 0.05); } #qfvwbyqenp .gt_table_body { border-top-style: solid; border-top-width: 1px; border-top-color: #000000; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #000000; } #qfvwbyqenp .gt_footnotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #qfvwbyqenp .gt_footnote { margin: 0px; font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #qfvwbyqenp .gt_sourcenotes { color: #333333; background-color: #FFFFFF; border-bottom-style: none; border-bottom-width: 2px; border-bottom-color: #D3D3D3; border-left-style: none; border-left-width: 2px; border-left-color: #D3D3D3; border-right-style: none; border-right-width: 2px; border-right-color: #D3D3D3; } #qfvwbyqenp .gt_sourcenote { font-size: 90%; padding-top: 4px; padding-bottom: 4px; padding-left: 5px; padding-right: 5px; } #qfvwbyqenp .gt_left { text-align: left; } #qfvwbyqenp .gt_center { text-align: center; } #qfvwbyqenp .gt_right { text-align: right; font-variant-numeric: tabular-nums; } #qfvwbyqenp .gt_font_normal { font-weight: normal; } #qfvwbyqenp .gt_font_bold { font-weight: bold; } #qfvwbyqenp .gt_font_italic { font-style: italic; } #qfvwbyqenp .gt_super { font-size: 65%; } #qfvwbyqenp .gt_footnote_marks { font-size: 75%; vertical-align: 0.4em; position: initial; } #qfvwbyqenp .gt_asterisk { font-size: 100%; vertical-align: 0; } #qfvwbyqenp .gt_indent_1 { text-indent: 5px; } #qfvwbyqenp .gt_indent_2 { text-indent: 10px; } #qfvwbyqenp .gt_indent_3 { text-indent: 15px; } #qfvwbyqenp .gt_indent_4 { text-indent: 20px; } #qfvwbyqenp .gt_indent_5 { text-indent: 25px; } </style>
Model 1 Model 2
B (SE) β \[95% CI\] B (SE) β \[95% CI\]

(Intercept)

1.21 (0.02)\*\*\*

-0.14 \[-0.18, -0.10\]

1.27 (0.02)\*\*\*

-0.14 \[-0.18, -0.10\]

Age

-0.00 (0.00)\*\*\*

-0.10 \[-0.12, -0.08\]

-0.00 (0.00)\*\*\*

-0.14 \[-0.17, -0.10\]

Gender (female)

0.11 (0.01)\*\*\*

0.24 \[0.20, 0.28\]

0.03 (0.03)   

0.24 \[0.20, 0.28\]

Poor health

0.23 (0.01)\*\*\*

0.44 \[0.42, 0.46\]

0.23 (0.01)\*\*\*

0.44 \[0.42, 0.46\]

France (vs DE)

-0.01 (0.01)   

-0.03 \[-0.08, 0.02\]

-0.01 (0.01)   

-0.03 \[-0.08, 0.02\]

UK (vs DE)

0.04 (0.01)\*\* 

0.08 \[0.03, 0.13\]

0.04 (0.01)\*\* 

0.08 \[0.03, 0.13\]

Education

-0.00 (0.00)†  

-0.02 \[-0.04, 0.00\]

Age x Female

0.00 (0.00)\*\* 

0.07 \[0.02, 0.11\]

N 6852 6852
R2 .20 .20
F-tests

F(5, 6846) = 337.06, p \< .001

F(7, 6844) = 243.10, p \< .001

Change ΔR2 = .00, F(2, 6844) = 6.78, p = .001
Given that dummy variables lose their interpretability when standardized (Fox, 2015), β for dummy variables are semi-standardized, indicating the impact of that dummy on the standardized outcome variable.
p \< .1, \* p \< .05, \*\* p \< .01, \*\*\* p \< .001

Related/alternative packages

  • modelsummary allows you to create highly customisable tables with data summaries or the output of statistical models that can be saved in a wide range of formats.
  • apa mostly offers functions that turn the output of statistical tests (e.g., t-tests) into text, in line with APA guidelines.
  • papaja offers the opportunity to create full APA-style journal manuscripts in R. It’s apa_table function is a generic alternative to the table functions in this package, which support many more types of models, but includes fewer details.

About

R package to quickly perform data analysis and reporting tasks that might otherwise be time intensive

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published