Learn R Programming

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

sjmisc (version 1.7)

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

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Lüdecke

Last Published

April 19th, 2016

Functions in sjmisc (1.7)

get_frq

Get summary of labelled vectors
chisq_gof

Chi-square goodness-of-fit-test
group_var

Recode numeric variables into equal-ranged groups
get_labels

Retrieve value labels of labelled data
dicho

Dichotomize variables
replace_na

Replace NA with specific values
set_na

Set NA for specific variable values
eta_sq

Eta-squared of fitted anova
efc

Sample dataset from the EUROFAMCARE project
is_crossed

Check whether two factors are crossed
group_labels

Create labels for recoded groups
fill_labels

Add missing value labels to partially labelled vector
cronb

Cronbach's Alpha for a matrix or data frame
frq

Summary of labelled vectors
read_spss

Import SPSS dataset as data frame into R
is_odd

Check whether value is odd
as_labelled

Convert vector to labelled class
mwu

Mann-Whitney-U-Test
str_pos

Find partial matching and close distance elements in strings
to_factor

Convert variable into factor and keep value labels
cramer

Cramer's V for a contingency table
add_labels

Add value labels to variables
get_values

Retrieve values of labelled variables
drop_labels

Drop labels of zero-count values
is_num_fac

Check whether a factor has numeric levels only
is_even

Check whether value is even
trim

Trim leading and trailing whitespaces from strings
is_nested

Check whether two factors are nested
converge_ok

Convergence test for mixed effects models
to_na

Convert missing values of labelled variables into NA
is_empty

Check whether string or vector is empty
read_sas

Import SAS dataset as data frame into R
icc

Intraclass-Correlation Coefficient
read_stata

Import STATA dataset as data frame into R
to_long

Convert wide data to long format
str_contains

Check if string contains pattern
zap_unlabelled

Convert non-labelled values into NA
merge_df

Merge labelled data frames
se

Standard Error for variables
get_note

Retrieve notes (annotations) from labelled variables
copy_labels

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

Weighted standard error for variables
is_labelled

Check whether object is of class "labelled"
rec_pattern

Create recode pattern for 'rec' function
mic

Mean Inter-Item-Correlation
group_str

Group near elements of string vectors
sjmisc-package

Data Transformation and Labelled Data Utility Functions
pseudo_r2

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

Remove value labels from variables
reliab_test

Performs a reliability test on an item scale
remove_all_labels

Remove value and variable labels from vector or data frame
get_label

Retrieve variable label(s) of labelled data
split_var

Split numeric variables into smaller groups
set_label

Add variable label(s) to variables
rec

Recode numeric variables
lbl_df

Create a labelled data frame
to_value

Convert factors to numeric variables
hoslem_gof

Hosmer-Lemeshow Goodness-of-fit-test
weight2

Weight a variable
std_beta

Standardized Beta coefficients and CI of lm and mixed models
set_note

Add notes (annotations) to (labelled) variables
re_var

Random effect variances
ref_lvl

Change reference level of (numeric) factors
zap_labels

Convert labelled values into NA
levene_test

Plot Levene-Test for One-Way-Anova
rmse

Root Mean Squared Error (RMSE)
phi

Phi value for contingency tables
to_label

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

Convert labelled vectors into normal classes
table_values

Expected and relative table values
word_wrap

Insert line breaks in long labels
get_na

Retrieve missing values of labelled variables
set_labels

Add value labels to variables
recode_to

Recode variable categories into new values
weight

Weight a variable
write_stata

Write content of data frame to STATA dta-file
write_spss

Write content of data frame to SPSS sav-file
labelled

Create a labelled vector
overdisp

Check overdispersion of GL(M)M's
r2

Compute R-squared of (generalized) linear (mixed) models
get_na_flags

Retrieve missing value flags of labelled variables
wtd_sd

Weighted standard deviation for variables
cv

Coefficient of Variation
cod

Tjur's Coefficient of Discrimination
mean_n

Row means with min amount of valid values
to_dummy

Split (categorical) vectors into dummy variables