Learn R Programming

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

sjmisc (version 1.6)

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

34,037

Version

1.6

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Lüdecke

Last Published

March 14th, 2016

Functions in sjmisc (1.6)

chisq_gof

Chi-square goodness-of-fit-test
efc

Sample dataset from the EUROFAMCARE project
replace_na

Replace NA with specific values
get_na

Retrieve missing values of labelled variables
mean_n

Row means with min amount of valid values
add_labels

Add value labels to variables
hoslem_gof

Hosmer-Lemeshow Goodness-of-fit-test
get_na_flags

Retrieve missing value flags of labelled variables
std_beta

Standardized Beta coefficients and CI of lm and mixed models
str_pos

Find partial matching and close distance elements in strings
read_sas

Import SAS dataset as data frame into R
is_num_fac

Check whether a factor has numeric levels only
dicho

Dichotomize variables
mwu

Mann-Whitney-U-Test
is_labelled

Check whether object is of class "labelled"
as_labelled

Convert vector to labelled class
copy_labels

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

Recode numeric variables
to_value

Convert factors to numeric variables
group_var

Recode numeric variables into equal-ranged groups
converge_ok

Convergence test for mixed effects models
get_labels

Retrieve value labels of labelled data
group_str

Group near elements of string vectors
cod

Tjur's Coefficient of Discrimination
reliab_test

Performs a reliability test on an item scale
set_na

Set NA for specific variable values
overdisp

Check overdispersion of GL(M)M's
is_crossed

Check whether two factors are crossed
pseudo_r2

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

Check whether value is even
mic

Mean Inter-Item-Correlation
remove_labels

Remove value labels from variables
weight

Weight a variable
is_empty

Check whether string or vector is empty
to_na

Convert missing values of labelled variables into NA
cv

Coefficient of Variation
get_frq

Get summary of labelled vectors
frq

Summary of labelled vectors
to_factor

Convert variable into factor and keep value labels
labelled

Create a labelled vector
zap_unlabelled

Convert non-labelled values into NA
to_dummy

Split (categorical) vectors into dummy variables
get_label

Retrieve variable label(s) of labelled data
rmse

Root Mean Squared Error (RMSE)
levene_test

Plot Levene-Test for One-Way-Anova
lbl_df

Create a labelled data frame
group_labels

Create labels for recoded groups
r2

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

Check whether value is odd
sjmisc-package

Data Transformation and Labelled Data Utility Functions
write_stata

Write content of data frame to STATA dta-file
is_nested

Check whether two factors are nested
remove_all_labels

Remove value and variable labels from vector or data frame
phi

Phi value for contingency tables
cramer

Cramer's V for a contingency table
table_values

Expected and relative table values
zap_labels

Convert labelled values into NA
read_spss

Import SPSS dataset as data frame into R
eta_sq

Eta-squared of fitted anova
drop_labels

Drop labels of zero-count values
fill_labels

Add missing value labels to partially labelled vector
get_values

Retrieve values of labelled variables
word_wrap

Insert line breaks in long labels
icc

Intraclass-Correlation Coefficient
recode_to

Recode variable categories into new values
unlabel

Convert labelled vectors into normal classes
split_var

Split numeric variables into smaller groups
to_long

Convert wide data to long format
se

Standard Error for variables
set_labels

Add value labels to variables
rec_pattern

Create recode pattern for 'rec' function
set_label

Add variable label(s) to variables
cronb

Cronbach's Alpha for a matrix or data frame
weight2

Weight a variable
write_spss

Write content of data frame to SPSS sav-file
ref_lvl

Change reference level of (numeric) factors
str_contains

Check if string contains pattern
trim

Trim leading and trailing whitespaces from strings
to_label

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

Import STATA dataset as data frame into R