SkillAgentSearch skills...

Rempsyc

Package of convenience functions to make your workflow faster and easier. Easily customizable plots (via ggplot2), nice APA tables exportable to Word (via flextable), easily run statistical tests or check assumptions, and automatize various other tasks.

Install / Use

/learn @rempsyc/Rempsyc
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<!-- README.md is generated from README.Rmd. Please edit that file -->

rempsyc: Convenience functions for psychology <img src='man/figures/logo.png' align="right" height="139" style="float:right; height:200px;" />

<!-- badges: start -->

R-CMD-check CRAN
status r-universe Last-commit lifecycle downloads total DOI sponsors followers stars

<!-- badges: end -->

R package of convenience functions to make your workflow faster and easier. Easily customizable plots (via ggplot2), nice APA tables exportable to Word (via flextable), easily run statistical tests or check assumptions, and automatize various other tasks. Mostly geared at researchers in the psychological sciences. The package is still under active development. Feel free to open an issue to ask for help, report a bug, or request a feature.

Top 40 new CRAN packages (2022)!

This is one of the most helpful R packages I’ve used in years! It saves hours of time and patience and is super easy to implement! - Mark (more testimonials)

Installation

You can install the rempsyc package directly from CRAN:

install.packages("rempsyc")

Or the development version from the r-universe (note that there is a 24-hour delay with GitHub):

install.packages("rempsyc", repos = c(
  rempsyc = "https://rempsyc.r-universe.dev",
  CRAN = "https://cloud.r-project.org"))

Or from GitHub, for the very latest version:

# If package `remotes` isn't already installed, install it with `install.packages("remotes")`
remotes::install_github("rempsyc/rempsyc")

You can load the package and open the help file, and click “Index” at the bottom. You will see all the available functions listed.

library(rempsyc)
?rempsyc

Dependencies: Because rempsyc is a package of convenience functions relying on several external packages, it uses (inspired by the easystats packages) a minimalist philosophy of only installing packages that you need when you need them through rlang::check_installed(). Should you wish to specifically install all suggested dependencies at once (you can view the full list by clicking on the CRAN badge on this page), you can run the following (be warned that this may take a long time, as some of the suggested packages are only used in the vignettes or examples):

install.packages("rempsyc", dependencies = TRUE)

Overview

Nice APA tables<a name = 'Nice APA tables'/>

T-tests, planned contrasts, regressions, moderations, simple slopes<a name = 'T-tests, planned contrasts, regressions, moderations, simple slopes'/>

Visualization<a name = 'Visualization'/>

Utility functions<a name = 'Utility functions'/>

Testing assumptions<a name = 'Testing assumptions'/>

lavaanExtra<a name = 'lavaanExtra'/>

Nice APA tables

nice_table

Make nice APA tables easily through a wrapper around the flextable package with sensical defaults and automatic formatting features.

The tables can be opened in Word with print(table, preview ="docx"), or saved to Word with the flextable::save_as_docx function, and are flextable objects, and can be modified as such. The function also integrates with objects from the broom and report packages. Full tutorial: https://rempsyc.remi-theriault.com/articles/table

Note: For a smoother and more integrated presentation flow, this function is now featured along the other functions.

T-tests, planned contrasts, regressions, moderations, simple slopes

nice_t_test

Easily compute t-test analyses, with effect sizes, and format in publication-ready format. Supports multiple dependent variables at once. The 95% confidence interval is for the effect size (Cohen’s d).

library(rempsyc)

t.tests <- nice_t_test(
  data = mtcars,
  response = c("mpg", "disp", "drat", "wt"),
  group = "am"
)
t.tests
#>   Dependent Variable         t       df              p         d   CI_lower
#> 1                mpg -3.767123 18.33225 0.001373638333 -1.477947 -2.2659732
#> 2               disp  4.197727 29.25845 0.000230041299  1.445221  0.6417836
#> 3               drat -5.646088 27.19780 0.000005266742 -2.003084 -2.8592770
#> 4                 wt  5.493905 29.23352 0.000006272020  1.892406  1.0300224
#>     CI_upper
#> 1 -0.6705684
#> 2  2.2295594
#> 3 -1.1245499
#> 4  2.7329219
# Format t-test results
t_table <- nice_table(t.tests)
t_table
<img src="man/figures/README-nice_t_test-1.png" />
# Open in Word for quick copy-pasting
print(my_table, preview = "docx")

# Or save to Word
flextable::save_as_docx(t_table, path = "D:/R treasures/t_tests.docx")

Full tutorial: https://rempsyc.remi-theriault.com/articles/t-test

nice_contrasts

Easily compute regression with planned contrast analyses (pairwise comparisons similar to t-tests but more powerful when more than 2 groups), and format in publication-ready format. Supports multiple dependent variables at once (but supports only three groups for the moment). In this particular case, the confidence intervals are bootstraped around the Cohen’s d.

contrasts <- nice_contrasts(
  data = mtcars,
  response = c("mpg", "disp"),
  group = "cyl",
  covariates = "hp"
)
contrasts
#>   Dependent Variable  Comparison df         t              p         d
#> 1                mpg cyl4 - cyl6 28  3.640418 0.001092088865  2.147244
#> 2                mpg cyl4 - cyl8 28  3.663188 0.001028617005  3.587739
#> 3                mpg cyl6 - cyl8 28  1.290359 0.207480642577  1.440495
#> 4               disp cyl4 - cyl6 28 -2.703423 0.011534398020 -1.514296
#> 5               disp cyl4 - cyl8 28 -6.040561 0.000001640986 -4.803022
#> 6               disp cyl6 - cyl8 28 -4.861413 0.000040511099 -3.288726
#>     CI_lower   CI_upper
#> 1  1.3531871  3.1223071
#> 2  2.7156109  4.4756393
#> 3  0.8435009  1.9939088
#> 4 -2.2636521 -0.8826532
#> 5 -5.8560355 -3.7464170
#> 6 -4.2833778 -2.2040887
# Format contrasts results
nice_table(contrasts, highlight = .001)
<img src="man/figures/README-nice_contrasts-1.png" />

Full tutorial: https://rempsyc.remi-theriault.com/articles/contrasts

nice_mod

Easily compute moderation analyses, with effect sizes, and format in publication-ready format. Supports multiple dependent variables and covariates at once.

moderations <- nice_mod(
  data = mtcars,
  response = c("mpg", "disp"),
  predictor = "gear",
  moderator = "wt"
)
moderations
#>   Model Number Dependent Variable Predictor df           B          t
#> 1            1                mpg      gear 28 -0.08718042 -0.7982999
#> 2            1                mpg        wt 28 -0.94959988 -8.6037724
#> 3            1                mpg   gear:wt 28 -0.23559962 -2.1551077
#> 4            2               disp      gear 28 -0.07488985 -0.6967831
#> 5            2               disp        wt 28  0.83273987  7.6662883
#> 6            2               disp   gear:wt 28 -0.08758665 -0.8140664
#>                   p         sr2     CI_lower   CI_upper
#> 1 0.431415645312884 0.004805465 0.0000000000 0.02702141
#> 2 0.000000002383144 0.558188818 0.3142326391 0.80214500
#> 3 0.039899695159515 0.035022025 0.0003502202 0.09723370
#> 4 0.491683361920264 0.003546038 0.0000000000 0.02230154
#> 5 0.000000023731710 0.429258143 0.1916386492 0.66687764
#> 6 0.422476456495512 0.004840251 0.0000000000 0.02679265
# Format moderation results
nice_table(moderations, highlight = TRUE)
<img src="man/figures/README-nice_mod-1.png" />

Full tutorial: https://rempsyc.remi-theriault.com/articles/moderation

nice_lm

For more complicated models not supported by nice_mod, one can define the model in the traditional way and feed it to nice_lm instead. Supports multiple lm models as well.

model1 <- lm(mpg ~ cyl + wt * hp, mtcars)
model2 <- lm(qsec ~ disp + drat * carb, mtcars)
mods <- nice_lm(list(model1, model2), standardize = TRUE)
mods
#>   Model Number Dependent Variable Predictor df          B          t
#> 1            1                mpg       cyl 27 -0.1082286 -0.7180977
#> 2            1                mpg        wt 27 -0.6230206 -5.7013627
#> 3            1                mpg        hp 27 -0.2874898 -2.4045781
#> 4            1                mpg     wt:hp 27  0.2875867  3.2329593
#> 5            2               qsec      disp 27 -0.4315891 -1.9746464
#> 6            2               qsec      drat 27 -0.3337401 -1.5296603
#> 7   
View on GitHub
GitHub Stars50
CategoryDevelopment
Updated3d ago
Forks5

Languages

R

Security Score

100/100

Audited on Mar 27, 2026

No findings