psychbruce
bruceR
R

๐Ÿ“ฆ BRoadly Useful Convenient and Efficient R functions that BRing Users Concise and Elegant R data analyses.

Last updated Jun 21, 2026
191
Stars
37
Forks
5
Issues
0
Stars/day
Attention Score
80
Language breakdown
R 100.0%
โ–ธ Files click to expand
README

bruceR

BRoadly Useful Convenient and Efficient R functions that BRing Users Concise and Elegant R data analyses.

This package includes easy-to-use functions for:

  • Basic R programming (e.g., set working directory to the path of currently opened file; import/export data from/to files in any format; print tables to Microsoft Word);
  • Multivariate computation (e.g., compute scale sums/means/... with reverse scoring);
  • Reliability analyses and factor analyses (PCA, EFA, CFA);
  • Descriptive statistics and correlation analyses;
  • t-test, multi-factor analysis of variance (ANOVA), simple-effect analysis, and post-hoc multiple comparison;
  • Tidy report of statistical models (to R Console and Microsoft Word);
  • Mediation and moderation analyses (PROCESS);
  • Additional toolbox for statistics and graphics.

CRAN-Version GitHub-Version R-CMD-check CRAN-Downloads GitHub-Stars

Author

Bruce H. W. S. Bao ๅŒ…ๅฏ’ๅด้œœ

๐Ÿ“ฌ baohws\@foxmail.com

๐Ÿ“‹ psychbruce.github.io

Citation

  • Bao, H. W. S. (2021). bruceR: Broadly useful convenient and efficient R functions.

User Guide

NEWS (Changelog)

Chinese Documentation for bruceR: I. Overview

Chinese Documentation for bruceR: II. FAQ

Installation

Please always set dep=TRUE to install ALL package dependencies for FULL features!

r

Method 1: Install from CRAN

install.packages("bruceR", dep=TRUE) # dependencies=TRUE

Method 2: Install from GitHub

install.packages("devtools") devtools::install_github("psychbruce/bruceR", dep=TRUE, force=TRUE)

Tips:

  • Good practices:
- Restart RStudio before installation. - Update R to the latest version (v4.0+). - Install Rtools.exe (it is not an R package) on Windows system.
  • If you see "Do you want to restart R prior to install?", choose "Yes" for the first time and then choose "No".
  • If you fail to install, please carefully read the warning messages and find out the R package(s) causing the failure, manually uninstall and reinstall these R package(s), and then retry the main installation.

Package Dependency

bruceR depends on many important R packages.

Loading bruceR with library(bruceR) will also load these R packages for you:

  • [Data]:
- data.table: Advanced data.frame with higher efficiency. - dplyr: Data manipulation and processing. - tidyr: Data cleaning and reshaping. - stringr: Toolbox for string operation (with regular expressions). - ggplot2: Data visualization.
  • [Stat]:
- emmeans: Estimates of marginal means and multiple contrasts. - lmerTest: Linear mixed effects modeling (multilevel modeling). - effectsize: Effect sizes and standardized parameters. - performance: Performance of regression models. - interactions: Interaction and simple effect analyses.

Main Functions in bruceR

  • Basic R Programming
- cc() (suggested) - set.wd() (alias: set_wd()) (suggested) - import(), export() (suggested) - pkg_depend() - formatF(), formatN() - print_table() - Print(), Glue(), Run() - %^% - %notin% - %allin%, %anyin%, %nonein%, %partin%
  • Multivariate Computation
- add(), added() (suggested) - .sum(), .mean() (suggested) - SUM(), MEAN(), STD(), MODE(), COUNT(), CONSEC() - RECODE(), RESCALE() - LOOKUP()
  • Reliability and Factor Analyses
- Alpha() - EFA() / PCA() - CFA()
  • Descriptive Statistics and Correlation Analyses
- Describe() - Freq() - Corr() - cor_diff() - cor_multilevel()
  • T-Test, Multi-Factor ANOVA, Simple-Effect Analysis, and Post-Hoc Multiple Comparison
- TTEST() - MANOVA() - EMMEANS()
  • Tidy Report of Regression Models
- model_summary() (suggested) - lavaan_summary() - GLM_summary() - HLM_summary() - HLMICCrWG() - regress()
  • Mediation and Moderation Analyses
- PROCESS() (suggested) - med_summary() - lavaan_summary()
  • Additional Toolbox for Statistics and Graphics
- grandmeancenter() - groupmeancenter() - ccf_plot() - granger_test() - granger_causality() - theme_bruce() - show_colors()

Function Output

For some functions, the results can be saved to Microsoft Word using the file argument.

| bruceR Function | Output: R Console | Output: MS Word | |:----------------------|:-----------------:|:-----------------:| | print_table() | โˆš | โˆš (basic usage) | | Describe() | โˆš | โˆš | | Freq() | โˆš | โˆš | | Corr() | โˆš | โˆš (suggested) | | Alpha() | โˆš | (unnecessary) | | EFA() / PCA() | โˆš | โˆš | | CFA() | โˆš | โˆš | | TTEST() | โˆš | โˆš | | MANOVA() | โˆš | โˆš | | EMMEANS() | โˆš | โˆš | | PROCESS() | โˆš | โˆš (partial) | | model_summary() | โˆš | โˆš (suggested) | | med_summary() | โˆš | โˆš | | lavaan_summary() | โˆš | โˆš | | GLM_summary() | โˆš | | | HLM_summary() | โˆš | | | HLMICCrWG() | โˆš | (unnecessary) | | granger_test() | โˆš | โˆš | | granger_causality() | โˆš | โˆš |

Examples:

r

Correlation analysis (and descriptive statistics)

Corr(airquality, file="cor.doc")

Regression analysis

lm1 = lm(Temp ~ Month + Day, data=airquality) lm2 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality) model_summary(list(lm1, lm2), file="reg.doc") modelsummary(list(lm1, lm2), std=TRUE, file="regstd.doc")

Learn More From Help Pages

r
library(bruceR)

Overview

help("bruceR") help(bruceR) ?bruceR

See help pages of functions

(use ?function or help(function))

?cc ?add ?.mean ?set.wd ?import ?export ?Describe ?Freq ?Corr ?Alpha ?MEAN ?RECODE ?TTEST ?MANOVA ?EMMEANS ?PROCESS ?model_summary ?lavaan_summary ?GLM_summary ?HLM_summary ...
๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท psychbruce/bruceR ยท Updated daily from GitHub