{"id":16272599,"url":"https://github.com/rempsyc/rempsyc","last_synced_at":"2025-03-16T13:31:16.263Z","repository":{"id":45501013,"uuid":"458589173","full_name":"rempsyc/rempsyc","owner":"rempsyc","description":"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.","archived":false,"fork":false,"pushed_at":"2025-02-10T18:05:27.000Z","size":656053,"stargazers_count":43,"open_issues_count":5,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T02:47:17.108Z","etag":null,"topics":["convenience-functions","ggplot2","psychology","r","rstats","statistics","visualization"],"latest_commit_sha":null,"homepage":"https://rempsyc.remi-theriault.com/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rempsyc.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"rempsyc"}},"created_at":"2022-02-12T17:17:55.000Z","updated_at":"2025-03-09T02:51:22.000Z","dependencies_parsed_at":"2023-02-13T01:31:35.384Z","dependency_job_id":"1bd1a38a-43a8-4fc2-a068-c2d0995bef17","html_url":"https://github.com/rempsyc/rempsyc","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rempsyc%2Frempsyc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rempsyc%2Frempsyc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rempsyc%2Frempsyc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rempsyc%2Frempsyc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rempsyc","download_url":"https://codeload.github.com/rempsyc/rempsyc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243875118,"owners_count":20361950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["convenience-functions","ggplot2","psychology","r","rstats","statistics","visualization"],"created_at":"2024-10-10T18:18:25.609Z","updated_at":"2025-03-16T13:31:16.256Z","avatar_url":"https://github.com/rempsyc.png","language":"R","funding_links":["https://github.com/sponsors/rempsyc"],"categories":[],"sub_categories":[],"readme":"---\noutput: \n  github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# rempsyc: Convenience functions for psychology \u003cimg src='man/figures/logo.png' align=\"right\" height=\"139\" style=\"float:right; height:200px;\" /\u003e\n\n```{r version, echo = FALSE, message = FALSE, warning = FALSE}\nflextable::set_flextable_defaults(background.color = \"white\")\n\noptions(scipen = 999)\nlibrary(rempsyc)\n```\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/rempsyc/rempsyc/workflows/R-CMD-check/badge.svg)](https://github.com/rempsyc/rempsyc/actions)\n[![CRAN status](https://www.r-pkg.org/badges/version/rempsyc)](https://cran.r-project.org/package=rempsyc)\n[![r-universe](https://rempsyc.r-universe.dev/badges/rempsyc)](https://rempsyc.r-universe.dev/rempsyc)\n[![Last-commit](https://img.shields.io/github/last-commit/rempsyc/rempsyc)](https://github.com/rempsyc/rempsyc/commits/main)\n[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![downloads](https://cranlogs.r-pkg.org/badges/rempsyc)](https://shinyus.ipub.com/cranview/)\n[![total](https://cranlogs.r-pkg.org/badges/grand-total/rempsyc)](https://shinyus.ipub.com/cranview/)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.05466/status.svg)](https://doi.org/10.21105/joss.05466)\n[![sponsors](https://img.shields.io/github/sponsors/rempsyc)](https://github.com/sponsors/rempsyc)\n[![followers](https://img.shields.io/github/followers/rempsyc?style=social)](https://github.com/rempsyc?tab=followers)\n[![stars](https://img.shields.io/github/stars/rempsyc/rempsyc?style=social)](https://github.com/rempsyc/rempsyc/stargazers)\n\u003c!-- badges: end --\u003e\n\nR 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.\n\n- [Release notes](https://rempsyc.remi-theriault.com/news/index.html)\n- [Development objectives (to-do list)](https://rempsyc.remi-theriault.com/TODOS.html)\n\nTop 40 new CRAN packages (2022)!\n\n\u003e *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](https://rempsyc.remi-theriault.com/articles/featured.html#testimonials))\n\n## Installation\n\nYou can install the `rempsyc` package directly from CRAN:\n``` r\ninstall.packages(\"rempsyc\")\n```\n\nOr the development version from the r-universe (note that there is a 24-hour delay with GitHub):\n``` r\ninstall.packages(\"rempsyc\", repos = c(\n  rempsyc = \"https://rempsyc.r-universe.dev\",\n  CRAN = \"https://cloud.r-project.org\"))\n```\n\nOr from GitHub, for the very latest version:\n``` r\n# If package `remotes` isn't already installed, install it with `install.packages(\"remotes\")`\nremotes::install_github(\"rempsyc/rempsyc\")\n```\n\nYou can load the package and open the help file, and click \"Index\" at the bottom. You will see all the available functions listed.\n``` r\nlibrary(rempsyc)\n?rempsyc\n```\n\n**Dependencies:** Because `rempsyc` is a package of convenience functions relying on several external packages, it uses (inspired by the [`easystats`](https://easystats.github.io/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):\n``` r\ninstall.packages(\"rempsyc\", dependencies = TRUE)\n```\n\n## Overview\n\n```{r headers, results = \"asis\", echo = FALSE}\nsection.1 \u003c- \"Nice APA tables\"\nsection.2 \u003c- \"T-tests, planned contrasts, regressions, moderations, simple slopes\"\nsection.3 \u003c- \"Visualization\"\nsection.4 \u003c- \"Utility functions\"\nsection.5 \u003c- \"Testing assumptions\"\nsection.6 \u003c- \"lavaanExtra\"\n\ncute_cat \u003c- function(x, header.level = 1) {\n  cat(rep(\"#\", header.level), \" \", x, sep = \"\")\n}\n\ncute_TOC \u003c- function(section) {\n  cat(\"[\", section, \"]\",\n    \"(#\", tolower(gsub(\" \", \"-\", gsub(\",\", \"\", section))), \")\",\n    \"\u003ca name = '\", section, \"'/\u003e\",\n    \"\\n \\n\",\n    sep = \"\"\n  )\n}\n\ninvisible(lapply(\n  list(\n    section.1, section.2, section.3, section.4, section.5, section.6\n  ),\n  cute_TOC\n))\n```\n\n## Nice APA tables\n\n## `nice_table`\n\nMake nice APA tables easily through a wrapper around the `flextable` package with sensical defaults and automatic formatting features.\n\nThe 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\n\nNote: For a smoother and more integrated presentation flow, this function is now featured along the other functions.\n\n## T-tests, planned contrasts, regressions, moderations, simple slopes\n\n## `nice_t_test`\n\nEasily 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).\n\n```{r nice_t_test, warning = FALSE, message = FALSE}\nlibrary(rempsyc)\n\nt.tests \u003c- nice_t_test(\n  data = mtcars,\n  response = c(\"mpg\", \"disp\", \"drat\", \"wt\"),\n  group = \"am\"\n)\nt.tests\n```\n\n```{r nice_table, results='hide'}\n# Format t-test results\nt_table \u003c- nice_table(t.tests)\nt_table\n```\n\n```{r save_as_image, include=FALSE}\ntable_temp \u003c- flextable::autofit(t_table)\nflextable::save_as_image(table_temp,\n  path = \"man/figures/README-nice_t_test-1.png\",\n  expand = 0, res = 300\n)\n```\n\n\u003cimg src=\"man/figures/README-nice_t_test-1.png\" /\u003e\n\n```{r table_save, warning = FALSE, message = FALSE, eval = FALSE}\n# Open in Word for quick copy-pasting\nprint(my_table, preview = \"docx\")\n\n# Or save to Word\nflextable::save_as_docx(t_table, path = \"D:/R treasures/t_tests.docx\")\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/t-test\n\n## `nice_contrasts `\n\nEasily 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.\n\n```{r set.seed, include=FALSE}\nset.seed(100)\n```\n\n```{r nice_contrasts, warning = FALSE, message = FALSE}\ncontrasts \u003c- nice_contrasts(\n  data = mtcars,\n  response = c(\"mpg\", \"disp\"),\n  group = \"cyl\",\n  covariates = \"hp\"\n)\ncontrasts\n```\n\n```{r, results=\"hide\"}\n# Format contrasts results\nnice_table(contrasts, highlight = .001)\n```\n\n```{r, include=FALSE}\ntable_temp \u003c- contrasts |\u003e\n  nice_table(highlight = .001) |\u003e\n  flextable::autofit()\nflextable::save_as_image(table_temp,\n  path = \"man/figures/README-nice_contrasts-1.png\",\n  expand = 0, res = 300\n)\n```\n\n\u003cimg src=\"man/figures/README-nice_contrasts-1.png\" /\u003e\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/contrasts\n\n## `nice_mod`\n\nEasily compute moderation analyses, with effect sizes, and format in publication-ready format. Supports multiple dependent variables and covariates at once.\n\n```{r nice_mod, warning = FALSE, message = FALSE}\nmoderations \u003c- nice_mod(\n  data = mtcars,\n  response = c(\"mpg\", \"disp\"),\n  predictor = \"gear\",\n  moderator = \"wt\"\n)\nmoderations\n```\n\n```{r, results=\"hide\"}\n# Format moderation results\nnice_table(moderations, highlight = TRUE)\n```\n\n```{r, include=FALSE}\ntable_temp \u003c- moderations |\u003e\n  nice_table(highlight = TRUE) |\u003e\n  flextable::autofit()\nflextable::save_as_image(table_temp,\n  path = \"man/figures/README-nice_mod-1.png\",\n  expand = 0, res = 300\n)\n```\n\n\u003cimg src=\"man/figures/README-nice_mod-1.png\" /\u003e\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/moderation\n\n## `nice_lm`\n\nFor 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.\n\n```{r nice_lm, warning = FALSE, message = FALSE}\nmodel1 \u003c- lm(mpg ~ cyl + wt * hp, mtcars)\nmodel2 \u003c- lm(qsec ~ disp + drat * carb, mtcars)\nmods \u003c- nice_lm(list(model1, model2), standardize = TRUE)\nmods\n```\n\n```{r, results=\"hide\"}\n# Format moderation results\nnice_table(mods, highlight = TRUE)\n```\n\n```{r, include=FALSE}\ntable_temp \u003c- mods |\u003e\n  nice_table(highlight = TRUE) |\u003e\n  flextable::autofit()\nflextable::save_as_image(table_temp,\n  path = \"man/figures/README-nice_lm-1.png\",\n  expand = 0, res = 300\n)\n```\n\n\u003cimg src=\"man/figures/README-nice_lm-1.png\" /\u003e\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/moderation\n\n## `nice_slopes`\n\nEasily compute simple slopes in moderation analysis, with effect sizes, and format in publication-ready format. Supports multiple dependent variables and covariates at once.\n\n```{r nice_slopes, warning = FALSE, message = FALSE}\nsimple.slopes \u003c- nice_slopes(\n  data = mtcars,\n  response = c(\"mpg\", \"disp\"),\n  predictor = \"gear\",\n  moderator = \"wt\"\n)\nsimple.slopes\n```\n\n```{r, results=\"hide\"}\n# Format simple slopes results\nnice_table(simple.slopes)\n```\n\n```{r, include=FALSE}\ntable_temp \u003c- simple.slopes |\u003e\n  nice_table() |\u003e\n  flextable::autofit()\nflextable::save_as_image(table_temp,\n  path = \"man/figures/README-nice_slopes-1.png\",\n  expand = 0, res = 300\n)\n```\n\n\u003cimg src=\"man/figures/README-nice_slopes-1.png\" /\u003e\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/moderation\n\n## `nice_lm_slopes`\n\nFor more complicated models not supported by `nice_slopes`, one can define the model in the traditional way and feed it to `nice_lm_slopes` instead. Supports multiple `lm` models as well, but the predictor and moderator need to be the same for these models (the dependent variable can change).\n\n```{r nice_lm_slopes, warning = FALSE, message = FALSE}\nmodel1 \u003c- lm(mpg ~ gear * wt, mtcars)\nmodel2 \u003c- lm(disp ~ gear * wt, mtcars)\nmy.models \u003c- list(model1, model2)\nsimple.slopes \u003c- nice_lm_slopes(my.models, predictor = \"gear\", moderator = \"wt\", standardize = TRUE)\nsimple.slopes\n```\n\n```{r, results=\"hide\"}\n# Format simple slopes results\nnice_table(simple.slopes)\n```\n\n```{r, include=FALSE}\ntable_temp \u003c- simple.slopes |\u003e\n  nice_table() |\u003e\n  flextable::autofit()\nflextable::save_as_image(table_temp,\n  path = \"man/figures/README-nice_lm_slopes-1.png\",\n  expand = 0, res = 300\n)\n```\n\n\u003cimg src=\"man/figures/README-nice_lm_slopes-1.png\" /\u003e\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/moderation\n\n## Visualization\n\nAll plots can be saved with the `ggplot2::ggsave()` function. They are `ggplot2` objects so can be modified as such. \n\n## `nice_violin`\n\nMake nice violin plots easily with 95% bootstrapped confidence intervals.\n\n```{r nice_violin, warning = FALSE, message = FALSE, fig.width=8, fig.height=7, out.width=\"60%\"}\nnice_violin(\n  data = ToothGrowth,\n  group = \"dose\",\n  response = \"len\",\n  xlabels = c(\"Low\", \"Medium\", \"High\"),\n  comp1 = 1,\n  comp2 = 3,\n  has.d = TRUE,\n  d.y = 30\n)\n```\n\n```{r, eval = FALSE}\n# Save plot\nggplot2::ggsave(\"niceplot.pdf\",\n  width = 7, height = 7, unit = \"in\",\n  dpi = 300, path = \"D:/R treasures/\"\n)\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/violin\n\n## `nice_scatter`\n\nMake nice scatter plots easily.\n\n```{r nice_scatter, warning = FALSE, message = FALSE, fig.width=8, fig.height=7, out.width=\"60%\"}\nnice_scatter(\n  data = mtcars,\n  predictor = \"wt\",\n  response = \"mpg\",\n  has.confband = TRUE,\n  has.r = TRUE,\n  has.p = TRUE\n)\n```\n\n```{r nice_scatter2, warning = FALSE, message = FALSE, fig.width=10, fig.height=7, out.width=\"70%\"}\nnice_scatter(\n  data = mtcars,\n  predictor = \"wt\",\n  response = \"mpg\",\n  group = \"cyl\",\n  has.confband = TRUE\n)\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/scatter\n\n## `plot_means_over_time`\n\nMake nice plots of means over time, usually for randomized controlled trials with several groups over several time measurements. Error bars represent 95% confidence intervals adjusted for within-subject variance as by the method of Morey (2008).\n\n```{r plot_means_over_time, warning = FALSE, message = FALSE, fig.width=9, fig.height=5, out.width=\"70%\"}\ndata \u003c- mtcars\nnames(data)[6:3] \u003c- paste0(\"T\", 1:4, \"_some-time-variable\")\n\nplot_means_over_time(\n  data = data,\n  response = names(data)[6:3],\n  group = \"cyl\",\n  groups.order = \"decreasing\",\n  significance_bars_x = c(3.15, 4.15),\n  significance_stars = c(\"*\", \"***\"),\n  significance_stars_x = c(3.25, 4.35),\n  # significance_stars_y: List with structure: list(c(\"group1\", \"group2\", time))\n  significance_stars_y = list(\n    c(\"4\", \"8\", time = 3),\n    c(\"4\", \"8\", time = 4)\n  )\n)\n```\n\n## `grouped_bar_chart`\n\nMake nice plots of means over time, usually for randomized controlled trials with several groups over several time measurements. Error bars represent 95% confidence intervals adjusted for within-subject variance as by the method of Morey (2008).\n\n```{r grouped_bar_chart, warning = FALSE, message = FALSE, out.width=\"70%\"}\niris2 \u003c- iris\niris2$plant \u003c- c(\n  rep(\"yes\", 45),\n  rep(\"no\", 45),\n  rep(\"maybe\", 30),\n  rep(\"NA\", 30)\n)\ngrouped_bar_chart(\n  data = iris2,\n  response = \"plant\",\n  group = \"Species\"\n)\n```\n\n## `overlap_circle `\n\nInterpolating the Inclusion of the Other in the Self Scale (self-other merging) easily.\n\n```{r overlap_circle, warning = FALSE, message = FALSE, fig.width=7, fig.height=7, out.width=\"30%\"}\n# Score of 3.5 (25% overlap)\noverlap_circle(3.5)\n\n# Score of 6.84 (81.8% overlap)\noverlap_circle(6.84)\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/circles\n\n## `cormatrix_excel`\n\nEasily output a correlation matrix and export it to Microsoft Excel, with the first row and column frozen, and correlation coefficients colour-coded based on their effect size (0.0-0.2: small (pink/light blue); 0.2-0.4: medium (orange/blue); 0.4-1.0: large (red/dark blue)).\n\n```{r cormatrix_excel2, warning = FALSE}\ncormatrix_excel(\n  data = infert,\n  filename = \"cormatrix1\",\n  select = c(\n    \"age\", \"parity\", \"induced\", \"case\", \"spontaneous\",\n    \"stratum\", \"pooled.stratum\"\n  )\n)\n```\n\n```{r cormatrix_excel_remove, include = FALSE}\nunlink(\"cormatrix1.xlsx\")\n```\n\n\u003cimg src=\"man/figures/cormatrix.png\" width=\"80%\" /\u003e\n\u003cimg src=\"man/figures/cormatrix2.png\" width=\"80%\" /\u003e\n\n## Utility functions\n\n## `nice_na`\n\nNicely reports NA values according to existing guidelines (i.e, reporting absolute or percentage of item-based missing values, plus each scale's maximum amount of missing values for a given participant). Accordingly, allows specifying a list of columns representing questionnaire items to produce a questionnaire-based report of missing values.\n\n```{r}\n# Create synthetic data frame for the demonstration\nset.seed(50)\ndf \u003c- data.frame(\n  scale1_Q1 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA),\n  scale1_Q2 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA),\n  scale1_Q3 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA),\n  scale2_Q1 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA),\n  scale2_Q2 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA),\n  scale2_Q3 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA),\n  scale3_Q1 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA),\n  scale3_Q2 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA),\n  scale3_Q3 = c(sample(c(NA, 1:6), replace = TRUE), NA, NA)\n)\n\n# Then select your scales by name\nnice_na(df, scales = c(\"scale1\", \"scale2\", \"scale3\"))\n\n# Or whole dataframe\nnice_na(df)\n```\n\n## `extract_duplicates`\n\nExtracts ALL duplicates (including the first one, contrary to `duplicated` or `dplyr::distinct`) to a data frame for visual inspection.\n\n```{r, extract_duplicates}\ndf1 \u003c- data.frame(\n  id = c(1, 2, 3, 1, 3),\n  item1 = c(NA, 1, 1, 2, 3),\n  item2 = c(NA, 1, 1, 2, 3),\n  item3 = c(NA, 1, 1, 2, 3)\n)\ndf1\n\nextract_duplicates(df1, id = \"id\")\n```\n\n## `best_duplicate`\n\nExtracts the \"best\" duplicate: the one with the fewer number of missing values (in case of ties, picks the first one).\n\n```{r, best_duplicate}\nbest_duplicate(df1, id = \"id\")\n```\n\n## `scale_mad`\n\nScale and center (\"standardize\") data based on the median and median absolute deviation (MAD).\n\n```{r, scale_mad}\nscale_mad(mtcars$mpg)\n```\n\n## `find_mad`\n\nIdentify outliers based on (e.g.,) 3 median absolute deviations (MAD) from the median.\n\n```{r, find_mad}\nfind_mad(data = mtcars, col.list = names(mtcars)[c(1:7, 10:11)], criteria = 3)\n```\n\n## `winsorize_mad`\n\nWinsorize outliers based on (e.g.,) 3 median absolute deviations (MAD).\n\n```{r, winsorize_mad}\nwinsorize_mad(mtcars$qsec, criteria = 3)\n```\n\n## `nice_reverse`\n\nEasily recode scores (reverse-score), typically for questionnaire answers.\n\n```{r nice_reverse, warning = FALSE, message = FALSE}\n# Reverse score of 5 with a maximum score of 5\nnice_reverse(5, 5)\n\n# Reverse scores with maximum = 4 and minimum = 0\nnice_reverse(1:4, 4, min = 0)\n\n# Reverse scores with maximum = 3 and minimum = -3\nnice_reverse(-3:3, 3, min = -3)\n```\n\n## `format_value`\n\nEasily format *p* or *r* values. Note: converts to `character` class for use in figures or manuscripts to accommodate e.g., \"\u003c .001\".\n\n```{r format_value, warning = FALSE, message = FALSE}\nformat_p(0.0041231)\nformat_p(t.tests$p)\nformat_r(moderations$sr2)\nformat_d(t.tests$d)\n```\n\n## `nice_randomize`\n\nRandomize easily with different designs.\n\n```{r nice_randomize, warning = FALSE, message = FALSE}\n# Specify design, number of conditions, number of participants, and names of conditions:\nnice_randomize(\n  design = \"between\", Ncondition = 4, n = 8,\n  condition.names = c(\"BP\", \"CX\", \"PZ\", \"ZL\")\n)\n\n# Within-Group Design\nnice_randomize(\n  design = \"within\", Ncondition = 3, n = 3,\n  condition.names = c(\"SV\", \"AV\", \"ST\")\n)\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/randomize\n\n## Testing assumptions\n\n## `nice_assumptions `\n\nTest linear regression assumptions easily with a nice summary table.\n\n```{r nice_assumptions, eval = FALSE, warning = FALSE, message = FALSE}\n# Create regression model\nmodel \u003c- lm(mpg ~ wt * cyl + gear, data = mtcars)\n# View results\nView(nice_assumptions(model))\n```\n\n\u003cimg src=\"man/figures/assumptions_table.png\" width=\"70%\" /\u003e\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/assumptions\n\n## `nice_normality `\n\nEasily make nice density and QQ plots per-group.\n\n```{r nice_normality, warning = FALSE, message = FALSE, fig.width=16, fig.height=7, out.width=\"80%\"}\nnice_normality(\n  data = iris,\n  variable = \"Sepal.Length\",\n  group = \"Species\",\n  grid = FALSE,\n  shapiro = TRUE,\n  histogram = TRUE\n)\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/assumptions\n\n## `plot_outliers`\n\nVisually check outliers based on (e.g.) +/- 3 MAD (median absolute deviations) or SD (standard deviations).\n\n```{r plot_outliers, warning = FALSE, message = FALSE, fig.width=8, fig.height=7, out.width=\"70%\"}\nplot_outliers(airquality,\n  group = \"Month\",\n  response = \"Ozone\"\n)\n\nplot_outliers(airquality,\n  response = \"Ozone\",\n  method = \"sd\"\n)\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/assumptions\n\n## `nice_var `\n\nObtain variance per group as well as check for the rule of thumb of one group having variance four times bigger than any of the other groups.\n\n```{r nice_var, warning = FALSE, message = FALSE}\nnice_var(\n  data = iris,\n  variable = \"Sepal.Length\",\n  group = \"Species\"\n)\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/assumptions\n\n## `nice_varplot`\n\nAttempt to visualize variance per group.\n\n```{r nice_varplot, warning = FALSE, message = FALSE, fig.width=8, fig.height=7, out.width=\"70%\"}\nnice_varplot(\n  data = iris,\n  variable = \"Sepal.Length\",\n  group = \"Species\"\n)\n```\n\nFull tutorial: https://rempsyc.remi-theriault.com/articles/assumptions\n\n## `lavaanExtra`\n\nFor an alternative, vector-based syntax to `lavaan` (a latent variable analysis/structural equation modeling package), as well as other convenience functions such as naming paths and defining indirect links automatically, see my other package, `lavaanExtra`.\n\nhttps://lavaanExtra.remi-theriault.com/\n\n## Support me and this package\n\nThank you for your support. You can support me and this package here: https://github.com/sponsors/rempsyc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frempsyc%2Frempsyc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frempsyc%2Frempsyc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frempsyc%2Frempsyc/lists"}