Learn R Programming

⚠️There's a newer version (2.8.10) of this package.Take me there.

sjmisc (version 1.5)

Data Transformation and Labelled Data Utility Functions

Description

Collection of miscellaneous utility functions (especially intended for people coming from other statistical software packages like 'SPSS', and/ or who are new to R), supporting following common tasks: 1) Reading and writing data between R and other statistical software packages like 'SPSS', 'SAS' or 'Stata' and working with labelled data; this includes easy ways to get and set label attributes, to convert labelled vectors into factors (and vice versa), or to deal with multiple declared missing values etc. 2) Data transformation tasks like recoding, dichotomizing or grouping variables, setting and replacing missing values. 3) Convenient functions to perform frequently used statistical tests, or to calculate various commonly used statistical coefficients.

Copy Link

Version

Install

install.packages('sjmisc')

Monthly Downloads

32,088

Version

1.5

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Lüdecke

Last Published

February 11th, 2016

Functions in sjmisc (1.5)

cv

Coefficient of Variation
as_labelled

Convert vector to labelled class
copy_labels

Copy value and variable labels to (subsetted) data frames
is_odd

Check whether value is odd
std_beta

Standardized Beta coefficients and CI of lm and mixed models
fill_labels

Add missing value labels to partially labelled vector
read_stata

Import STATA dataset as data frame into R
weight2

Weight a variable
chisq_gof

Chi-square goodness-of-fit-test
get_label

Retrieve variable label(s) of labelled data
sjmisc-package

Data Transformation and Labelled Data Utility Functions
labelled

Create a labelled vector
recode_to

Recode variable categories into new values
zap_unlabelled

Convert non-labelled values into NA
pseudo_r2

Nagelkerke's and Cox-Snell's Pseudo R-squared
converge_ok

Convergence test for mixed effects models
add_labels

Add value labels to variables
cronb

Cronbach's Alpha for a matrix or data frame
set_na

Set NA for specific variable values
mic

Mean Inter-Item-Correlation
get_na

Retrieve missing values of labelled variables
read_sas

Import SAS dataset as data frame into R
table_values

Expected and relative table values
is_even

Check whether value is even
levene_test

Plot Levene-Test for One-Way-Anova
cod

Tjur's Coefficient of Discrimination
split_var

Split numeric variables into smaller groups
get_na_flags

Retrieve missing value flags of labelled variables
unlabel

Convert labelled data (frames) into normal classes
frq

Summary of labelled vectors
overdisp

Check overdispersion of GLMM's
efc

Sample dataset from the EUROFAMCARE project
group_str

Group near elements of string vectors
to_value

Convert factors to numeric variables
dicho

Dichotomize variables
cramer

Cramer's V for a contingency table
get_labels

Retrieve value labels of labelled data
is_num_fac

Check whether a factor has numeric levels only
is_crossed

Check whether two factors are crossed
is_empty

Check whether string or vector is empty
to_na

Convert missing values of labelled variables into NA
get_values

Retrieve values of labelled variables
mwu

Mann-Whitney-U-Test
group_var

Recode numeric variables into equal-ranged groups
remove_labels

Remove value labels from variables
eta_sq

Eta-squared of fitted anova
to_long

Convert wide data to long format
is_labelled

Check whether object is of class "labelled"
to_factor

Convert variable into factor and keep value labels
set_labels

Add value labels to variables
replace_na

Replace NA with specific values
write_spss

Write content of data frame to SPSS sav-file
ref_lvl

Change reference level of (numeric) factors
trim

Trim leading and trailing whitespaces from strings
rec

Recode numeric variables
icc

Intra-Class-Correlation Coefficient
str_pos

Find partial matching and close distance elements in strings
remove_all_labels

Remove value and variable labels from vector or data frame
is_nested

Check whether two factors are nested
set_label

Add variable label(s) to variables
se

Standard Error for variables
zap_labels

Convert labelled values into NA
group_labels

Create labels for recoded groups
reliab_test

Performs a reliability test on an item scale
weight

Weight a variable
write_stata

Write content of data frame to STATA dta-file
read_spss

Import SPSS dataset as data frame into R
to_label

Convert variable into factor and replaces values with associated value labels
to_dummy

Split (categorical) vectors into dummy variables
rmse

Root Mean Squared Error (RMSE)
hoslem_gof

Hosmer-Lemeshow Goodness-of-fit-test
mean_n

Row means with min amount of valid values
phi

Phi value for contingency tables
word_wrap

Insert line breaks in long labels