BRoadly Useful Convenient and Efficient R functions that BRing Users Concise and Elegant R data analyses.
This package includes easy-to-use functions for:
Han-Wu-Shuang (Bruce) Bao 包寒吴霜
Email: baohws@foxmail.com
Homepage: psychbruce.github.io
Chinese Documentation for bruceR: I. Overview
Chinese Documentation for bruceR: II. FAQ
## Method 1: Install from CRAN
install.packages("bruceR", dep=TRUE) # dependencies=TRUE
## Method 2: Install from GitHub
install.packages("devtools")
::install_github("psychbruce/bruceR", dep=TRUE, force=TRUE) devtools
Tips:
bruceR
depends on many important R packages.
Loading bruceR
by library(bruceR)
will also
load these R packages for you:
[Data]:
dplyr
:
Data manipulation and processing.tidyr
:
Data cleaning and reshaping.stringr
:
Toolbox for string operation (with regular expressions).forcats
:
Toolbox for factor manipulation (for categorical variables).data.table
:
Advanced data.frame
with higher efficiency.[Stat]:
emmeans
:
Estimates of marginal means and multiple contrasts.effectsize
:
Estimates of effect sizes and standardized parameters.performance
:
Estimates of regression models performance.lmerTest
:
Tests of linear mixed effects models (LMM, also known as HLM and
multilevel models).[Plot]:
bruceR
Basic R Programming
cc()
(suggested)set.wd()
(alias: set_wd()
)
(suggested)import()
, export()
(suggested)pkg_depend()
, pkg_install_suggested()
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()
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()
HLM_ICC_rWG()
regress()
Mediation and Moderation Analyses
PROCESS()
(suggested)med_summary()
Additional Toolbox for Statistics and Graphics
grand_mean_center()
group_mean_center()
ccf_plot()
granger_test()
granger_causality()
theme_bruce()
show_colors()
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
= lm(Temp ~ Month + Day, data=airquality)
lm1 = lm(Temp ~ Month + Day + Wind + Solar.R, data=airquality)
lm2 model_summary(list(lm1, lm2), file="reg.doc")
model_summary(list(lm1, lm2), std=TRUE, file="reg_std.doc")
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 ...