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:

  1. 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);
  2. Multivariate computation (e.g., compute scale sums/means/… with reverse scoring);
  3. Reliability analyses and factor analyses (PCA, EFA, CFA);
  4. Descriptive statistics and correlation analyses;
  5. t-test, multi-factor analysis of variance (ANOVA), simple-effect analysis, and post-hoc multiple comparison;
  6. Tidy report of statistical models (to R Console and Microsoft Word);
  7. Mediation and moderation analyses (PROCESS);
  8. Additional toolbox for statistics and graphics.

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

Author

Han-Wu-Shuang (Bruce) Bao 包寒吴霜

📬 baohws@foxmail.com

📋 psychbruce.github.io

Citation

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!

## 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:

Package Dependency

bruceR depends on many important R packages.

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

Main Functions in bruceR

  1. Basic R Programming

  2. Multivariate Computation

  3. Reliability and Factor Analyses

  4. Descriptive Statistics and Correlation Analyses

  5. T-Test, Multi-Factor ANOVA, Simple-Effect Analysis, and Post-Hoc Multiple Comparison

  6. Tidy Report of Regression Models

  7. Mediation and Moderation Analyses

  8. Additional Toolbox for Statistics and Graphics

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()
HLM_ICC_rWG() (unnecessary)
granger_test()
granger_causality()

Examples:

## 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")
model_summary(list(lm1, lm2), std=TRUE, file="reg_std.doc")

Learn More From Help Pages

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
...