sjmisc: Data Transformation and Labelled Data Utility Functions

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 when working with data : 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. The data transformation functions also support labelled data.

Author
Daniel Lüdecke <d.luedecke@uke.de>
Date of publication
2016-11-13 15:42:33
Maintainer
Daniel Lüdecke <d.luedecke@uke.de>
License
GPL-3
Version
2.1.0
URLs

View on CRAN

Man pages

add_labels
Add or replace value labels of variables
as_labelled
Convert vector to labelled class
big_mark
Formats large numbers with big marks
copy_labels
Copy value and variable labels to (subsetted) data frames
count_na
Frequency table of tagged NA values
dicho
Dichotomize variables
drop_labels
Drop labels of zero-count values
efc
Sample dataset from the EUROFAMCARE project
empty_cols
Return or remove variables or observations that are...
fill_labels
Add missing value labels to partially labelled vector
find_var
Find variable by name or label
flat_table
Flat (proportional) tables
frq
Frequencies of labelled variables
get_label
Retrieve variable label(s) of labelled data
get_labels
Retrieve value labels of labelled data
get_na
Retrieve tagged NA values of labelled variables
get_note
Retrieve notes (annotations) from labelled variables
get_values
Retrieve values of labelled variables
group_labels
Create labels for recoded groups
group_str
Group near elements of string vectors
group_var
Recode numeric variables into equal-ranged groups
is_crossed
Check whether two factors are crossed
is_empty
Check whether string or vector is empty
is_even
Check whether value is even
is_labelled
Check whether object is of class "labelled"
is_nested
Check whether two factors are nested
is_num_fac
Check whether a factor has numeric levels only
is_odd
Check whether value is odd
lbl_df
Create a labelled data frame
merge_df
Merge labelled data frames
merge_imputations
Merges multiple imputed data frames into a single data frame
read_sas
Import SAS dataset as data frame into R
read_spss
Import SPSS dataset as data frame into R
read_stata
Import STATA dataset as data frame into R
rec
Recode variables
recode_to
Recode variable categories into new values
rec_pattern
Create recode pattern for 'rec' function
ref_lvl
Change reference level of (numeric) factors
remove_all_labels
Remove value and variable labels from vector or data frame
remove_labels
Remove value labels from variables
replace_na
Replace NA with specific values
set_label
Add variable label(s) to variables
set_labels
Add value labels to variables
set_na
Replace specific values in vector with NA
set_note
Add notes (annotations) to (labelled) variables
sjmisc-package
Data Transformation and Labelled Data Utility Functions
split_var
Split numeric variables into smaller groups
spread_coef
Spread model coefficients of list-variables into columns
str_contains
Check if string contains pattern
str_pos
Find partial matching and close distance elements in strings
to_character
Convert variable into character vector and replace values...
to_dummy
Split (categorical) vectors into dummy variables
to_factor
Convert variable into factor and keep value labels
to_label
Convert variable into factor and replace values with...
to_long
Convert wide data to long format
to_value
Convert factors to numeric variables
trim
Trim leading and trailing whitespaces from strings
unlabel
Convert labelled vectors into normal classes
var_labels
Add variable label(s) to variables
var_rename
Rename variables
word_wrap
Insert line breaks in long labels
write_sas
Write content of data frame to SAS-file
write_spss
Write content of data frame to SPSS sav-file
write_stata
Write content of data frame to STATA dta-file
zap_labels
Convert (non-)labelled values into NA
zap_na_tags
Convert tagged NA values into regular NA

Files in this package

sjmisc
sjmisc/inst
sjmisc/inst/CITATION
sjmisc/NAMESPACE
sjmisc/NEWS
sjmisc/NEWS.md
sjmisc/data
sjmisc/data/efc.RData
sjmisc/R
sjmisc/R/S3-methods.R
sjmisc/R/recode_to.R
sjmisc/R/remove_all_labels.R
sjmisc/R/group_str.R
sjmisc/R/is_crossed.R
sjmisc/R/to_dummy.R
sjmisc/R/is_odd.R
sjmisc/R/count_na.R
sjmisc/R/big_mark.R
sjmisc/R/frq.R
sjmisc/R/to_factor.R
sjmisc/R/as_labelled.R
sjmisc/R/read_write.R
sjmisc/R/merge_df.R
sjmisc/R/get_labels.R
sjmisc/R/copy_labels.R
sjmisc/R/replace_na.R
sjmisc/R/is_nested.R
sjmisc/R/var_labels.R
sjmisc/R/remove_labels.R
sjmisc/R/set_na.R
sjmisc/R/is_num_fac.R
sjmisc/R/drop_labels.R
sjmisc/R/get_na.R
sjmisc/R/merge_imputations.R
sjmisc/R/is_labelled.R
sjmisc/R/str_contains.R
sjmisc/R/is_empty.R
sjmisc/R/is_even.R
sjmisc/R/find_var.R
sjmisc/R/get_values.R
sjmisc/R/set_labels.R
sjmisc/R/get_label.R
sjmisc/R/get_note.R
sjmisc/R/group_var.R
sjmisc/R/rec.R
sjmisc/R/helpfunctions.R
sjmisc/R/to_value.R
sjmisc/R/trim.R
sjmisc/R/dicho.R
sjmisc/R/prop_table.R
sjmisc/R/set_label.R
sjmisc/R/rec_pattern.R
sjmisc/R/efc.R
sjmisc/R/str_pos.R
sjmisc/R/word_wrap.R
sjmisc/R/to_label.R
sjmisc/R/unlabel.R
sjmisc/R/to_long.R
sjmisc/R/zap_labels.R
sjmisc/R/ref_lvl.R
sjmisc/R/fill_labels.R
sjmisc/R/split_var.R
sjmisc/R/add_labels.R
sjmisc/R/spread_coef.R
sjmisc/README.md
sjmisc/MD5
sjmisc/build
sjmisc/build/partial.rdb
sjmisc/DESCRIPTION
sjmisc/man
sjmisc/man/is_num_fac.Rd
sjmisc/man/group_labels.Rd
sjmisc/man/group_var.Rd
sjmisc/man/lbl_df.Rd
sjmisc/man/zap_na_tags.Rd
sjmisc/man/merge_imputations.Rd
sjmisc/man/to_long.Rd
sjmisc/man/get_values.Rd
sjmisc/man/to_dummy.Rd
sjmisc/man/set_note.Rd
sjmisc/man/to_character.Rd
sjmisc/man/set_na.Rd
sjmisc/man/write_sas.Rd
sjmisc/man/as_labelled.Rd
sjmisc/man/set_label.Rd
sjmisc/man/read_stata.Rd
sjmisc/man/sjmisc-package.Rd
sjmisc/man/write_stata.Rd
sjmisc/man/is_nested.Rd
sjmisc/man/frq.Rd
sjmisc/man/group_str.Rd
sjmisc/man/is_crossed.Rd
sjmisc/man/flat_table.Rd
sjmisc/man/read_spss.Rd
sjmisc/man/to_factor.Rd
sjmisc/man/get_labels.Rd
sjmisc/man/is_empty.Rd
sjmisc/man/is_labelled.Rd
sjmisc/man/ref_lvl.Rd
sjmisc/man/str_contains.Rd
sjmisc/man/var_labels.Rd
sjmisc/man/replace_na.Rd
sjmisc/man/word_wrap.Rd
sjmisc/man/to_label.Rd
sjmisc/man/rec.Rd
sjmisc/man/get_note.Rd
sjmisc/man/efc.Rd
sjmisc/man/big_mark.Rd
sjmisc/man/empty_cols.Rd
sjmisc/man/split_var.Rd
sjmisc/man/var_rename.Rd
sjmisc/man/merge_df.Rd
sjmisc/man/fill_labels.Rd
sjmisc/man/spread_coef.Rd
sjmisc/man/str_pos.Rd
sjmisc/man/rec_pattern.Rd
sjmisc/man/get_na.Rd
sjmisc/man/trim.Rd
sjmisc/man/find_var.Rd
sjmisc/man/zap_labels.Rd
sjmisc/man/unlabel.Rd
sjmisc/man/is_odd.Rd
sjmisc/man/get_label.Rd
sjmisc/man/recode_to.Rd
sjmisc/man/count_na.Rd
sjmisc/man/write_spss.Rd
sjmisc/man/drop_labels.Rd
sjmisc/man/remove_labels.Rd
sjmisc/man/remove_all_labels.Rd
sjmisc/man/copy_labels.Rd
sjmisc/man/to_value.Rd
sjmisc/man/dicho.Rd
sjmisc/man/add_labels.Rd
sjmisc/man/read_sas.Rd
sjmisc/man/is_even.Rd
sjmisc/man/set_labels.Rd