Learn R Programming

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

sjmisc (version 1.2)

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

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Lüdecke

Last Published

October 12th, 2015

Functions in sjmisc (1.2)

cramer

Cramer's V for a contingency table
is_even

Check whether value is even
converge_ok

Convergence test for mixed effects models
is_num_fac

Check whether a factor has numeric levels only
get_na_flags

Retrieve missing value flags of labelled variables
group_var

Recode count variables into grouped factors
cronb

Cronbach's Alpha for a matrix or data frame
get_na

Retrieve missing values of labelled variables
get_values

Retrieve values of labelled variables
labelled

Create a labelled vector
weight2

Weight a variable
group_str

Group near elements of string vectors
get_labels

Retrieve value labels of labelled data
set_na

Set NA for specific variable values
read_sas

Import SAS dataset as data frame into R
weight

Weight a variable
zap_labels

Convert labelled values into NA
cod

Tjur's Coefficient of Discrimination
reliab_test

Performs a reliability test on an item scale
efc

Sample dataset from the EUROFAMCARE project
remove_labels

Remove value and variable labels from vector or data frame
cv

Coefficient of Variation
is_empty

Check whether string is empty
dicho

Dichotomize variables
mwu

Mann-Whitney-U-Test
mean_n

Row means with min amount of valid values
group_labels

Create labels for recoded groups
get_label

Retrieve variable label(s) of labelled data
set_labels

Add value labels to variables
set_label

Add variable label(s) to variables
trim

Trim leading and trailing whitespaces from strings
table_values

Expected and relative table values
is_crossed

Check whether two factors are crossed
is_labelled

Check whether object is of class "labelled"
rec

Recode numeric variables
add_labels

Add value labels to variables
sjmisc-package

Data Transformation and Labelled Data Utility Functions
chisq_gof

Chi-square goodness-of-fit-test
is_odd

Check whether value is odd
replace_na

Replace NA with specific values
to_sjPlot

Convert labelled data (frames) into normal classes
zap_unlabelled

Convert non-labelled values into NA
frq

Summary of labelled vectors
to_na

Convert missing values of labelled variables into NA
to_value

Convert factors to numeric variables
copy_labels

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

Import STATA dataset as data frame into R
icc

Intra-Class-Correlation Coefficient
hoslem_gof

Hosmer-Lemeshow Goodness-of-fit-test
se

Standard Error for variables
rmse

Root Mean Squared Error (RMSE)
read_spss

Import SPSS dataset as data frame into R
to_factor

Convert variable into factor and keep value labels
std_beta

Standardized Beta coefficients and CI of lm and mixed models
levene_test

Plot Levene-Test for One-Way-Anova
pseudo_r2

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

Phi value for contingency tables
as_labelled

Convert vector to labelled class
str_pos

Find partial matching and close distance elements in strings
recode_to

Recode variable categories into new values
to_label

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

Write content of data frame to SPSS sav-file
write_stata

Write content of data frame to STATA dta-file
eta_sq

Eta-squared of fitted anova
word_wrap

Insert line breaks in long labels
fill_labels

Add missing value labels to partially labelled vector
mic

Mean Inter-Item-Correlation
is_nested

Check whether two factors are nested