Learn R Programming

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

kutils (version 1.69)

Project Management Tools

Description

Tools for data importation, recoding, and inspection that are used at the University of Kansas Center for Research Methods and Data Analysis. There are functions to create new project folders, R code templates, create uniquely named output directories, and to quickly obtain a visual summary for each variable in a data frame. The main feature here is the systematic implementation of the "variable key" framework for data importation and recoding. We are eager to have community feedback about the variable key and the vignette about it. In version 1.67, the function semTable() is deprecated. We have proposed a new package of that name.

Copy Link

Version

Install

install.packages('kutils')

Monthly Downloads

13,877

Version

1.69

License

GPL-2

Maintainer

Paul Johnson

Last Published

May 12th, 2019

Functions in kutils (1.69)

deleteBogusColumns

Remove columns in which the proportion of missing data exceeds a threshold.
assignRecode

A variable is transformed in an indicated way
keyApply

Apply variable key to data frame (generate recoded data frame)
keyTemplateSPSS

Import an SPSS file, create a key representing the numeric -> factor transition
markupConvert

Convert marked-up semTable structures to latex, html, or csv
escape

Text that is to be included as content in documents is cleaned (escaped) to prevent errors
dts

Delete trailing slash
isNA

Check if values are R NA symbol or any one of the na.strings elements
keyTemplate

Create variable key template (in memory or in a file)
makeKeylist

Convert the variable key into a list of long keys, one for each variable.
compareLavaan

Prepare a table to compare fit measures of confirmatory factor analyses (CFA)
file.backup

Create a backup version of a file by renaming it.
keyTemplateStata

Import a Stata (version 12 or lower) file, create a key representing the numeric -> factor transition
detectNested

Discern nesting pattern of SEM coefficients
importQualtrics

Import Qualtrics survey files, apply clean column names
likert

Percentage tables for Likert Scale variables
keyUpdate

Update a key in light of a new data frame (add variables and values)
dev.create

Create a graphics device
deleteBogusRows

Remove rows in which the proportion of missing data exceeds a threshold.
long2wide

convert a key object from long to wide format
deduper

Removes redundant words from beginnings of character strings
initProject

Create project directories, initialize a git repo, create README.md ChangeLog, and R template file in R directory
keyCheck

Check a key for consistency of names, values with classes.
print.kutable

A print method for kutable objects
starsig

How many stars would we need for this p value?
print.likert

print method for likert tables
sortStanza

Move missing values to last row in long key block
keyCrossRef

keyCrossRef
dir.create.unique

Create a uniquely named directory. Appends number & optionally date to directory name.
keyDiagnostic

Diagnose accuracy of result from applying variable key to data
keysPool

Homogenize class values and create a long key by pooling variable keys.
dms

Delete multiple slashes, replace with one
keyImport

Import/validate a key object or import/validate a key from a file.
is.data.frame.simple

Check if a data frame is a simple collection of columns (no lists or matrices within)
keyRead

Read file after deducing file type from suffix.
keySave

Save key as file after deducing type from suffix
keyDiff

Show difference between 2 keys
keysPoolCheck

Compares keys from different data sets; finds differences classes of variables. This used to check for similarity of keys from various data sets, one precursor to either combining the keys or merging the data sets themselves.
padW0

Insert 0's in the front of existing digits or characters so that all elements of a vector have the same number of characters.
peek

Show variables, one column at a time.
naLast

Sort key so that non missing values are first in the value vector.
updatePackages

Update packages, spot new dependencies, and install them
wide2long

Convert a key object from wide to long format
varlabTemplate

Create Variable Label Template
natlongsurv

Smoking, Happiness, and other survey responses
qualtricsBlockStack

Create meta data frame to align identical questions
removeMatches

Remove elements if they are in a target vector, possibly replacing with NA
mergeCheck

First draft of function to diagnose problems in merges and key variables
keyLookup

Look for old (or new) names in variable key
statdatKey

keyFactors: private function that does work for keyTemplateSPSS and key template Stata
writeCSV

Write CSV files with quotes same as MS Excel 2013 or newer
modifyVector

Use new information to update a vector. Similar in concept to R's modify list
stringbreak

Insert "\n" after the k'th character in a string. This IS vectorized, so can receive just one or many character strings in a vector.
n2NA

Convert nothing to R missing(NA).
reverse

Reverse the levels in a factor
print.keyDiff

Print a keyDiff object
mgsub

apply a vector of replacements, one after the other.
safeInteger

If a numeric variable has only integer values, then make it an integer.
print.keycheck

Print out the result of mergeCheck function.
testtable

Test viewer for tex tables
semTable

Creates Structural Equation Modeling Tables
truncsmart

Cuts a string at a specified linewidth, trying to align cut with a separator
shorten

Reduce each in a vector of strings to a given length
zapspace

Convert leading or trailing white space and tab characters to nothing.
assignMissing

Set missing values
all.equal.key

An all.equal method for variable wide keys
colnamesReplace

Replace column names with new names from a named vector
alphaOnly

Keep only alpha-numeric symbols
anonomize

Create unique anonymous id values
cleanDataFrame

Check and Clean data.frame for usage with variable key functions
all.equal.keylong

An all.equal method for variable long keys
checkCoercion

Check if values can be safely coerced without introduction of missing values
checkValue_old

Compare observed values with the values listed (presumably from a variable key).