Learn R Programming

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.

Author

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

Copy Link

Version

Install

install.packages('bruceR')

Monthly Downloads

2,890

Version

2023.9

License

GPL-3

Maintainer

Han-Wu-Shuang Bao

Last Published

September 27th, 2023

Functions in bruceR (2023.9)

RGB

A simple extension of rgb().
Run

Run code parsed from text.
EMMEANS

Simple-effect analysis and post-hoc multiple comparison.
Alpha

Reliability analysis (Cronbach's \(\alpha\) and McDonald's \(\omega\)).
MANOVA

Multi-factor ANOVA.
LOOKUP

Search, match, and look up values (like Excel's functions INDEX + MATCH).
CFA

Confirmatory Factor Analysis (CFA).
Freq

Frequency statistics.
cor_diff

Test the difference between two correlations.
RESCALE

Rescale a variable (e.g., from 5-point to 7-point).
RECODE

Recode a variable.
GLM_summary

Tidy report of GLM (lm and glm models).
cor_multilevel

Multilevel correlations (within-level and between-level).
export

Export data to a file (TXT, CSV, Excel, SPSS, Stata, ...) or clipboard.
PROCESS

PROCESS for mediation and/or moderation analyses.
dtime

Timer (compute time difference).
Print

Print strings with rich formats and colors.
%nonein%

A simple extension of %in%.
HLM_summary

Tidy report of HLM (lmer and glmer models).
HLM_ICC_rWG

Tidy report of HLM indices: ICC(1), ICC(2), and rWG/rWG(J).
cc

Split up a string (with separators) into a character vector.
bruceR-demodata

Demo data.
%notin%

The opposite of %in%.
lavaan_summary

Tidy report of lavaan model.
%anyin%

A simple extension of %in%.
model_summary

Tidy report of regression models.
p

Compute p value.
%%COMPUTE%%

Multivariate computation.
bruceR-package

bruceR: BRoadly Useful Convenient and Efficient R functions
%^%

Paste strings together.
%partin%

A simple extension of %in%.
med_summary

Tidy report of mediation analysis.
theme_bruce

A nice ggplot2 theme that enables Markdown/HTML rich text.
add

Create, modify, and delete variables.
formula_expand

Expand all interaction terms in a formula.
formula_paste

Paste a formula into a string.
TTEST

One-sample, independent-samples, and paired-samples t-test.
print_table

Print a three-line table (to R Console and Microsoft Word).
regress

Regression analysis.
group_mean_center

Group-mean centering.
set.wd

Set working directory to the path of currently opened file.
formatF

Format numeric values.
ccf_plot

Cross-correlation analysis.
formatN

Format "1234" to "1,234".
pkg_depend

Check dependencies of R packages.
grand_mean_center

Grand-mean centering.
granger_causality

Granger causality test (multivariate).
import

Import data from a file (TXT, CSV, Excel, SPSS, Stata, ...) or clipboard.
granger_test

Granger causality test (bivariate).
pkg_install_suggested

Install suggested R packages.
rep_char

Repeat a character string for many times and paste them up.
scaler

Min-max scaling (min-max normalization).
show_colors

Show colors.
%allin%

A simple extension of %in%.
Corr

Correlation analysis.
EFA

Principal Component Analysis (PCA) and Exploratory Factor analysis (EFA).
Describe

Descriptive statistics.