Learn R Programming

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

kutils (version 1.0)

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.

Copy Link

Version

Install

install.packages('kutils')

Monthly Downloads

13,877

Version

1.0

License

GPL-2

Maintainer

Paul Johnson

Last Published

May 19th, 2017

Functions in kutils (1.0)

alphaOnly

Keep only alpha-numeric symbols
assignMissing

Set missing values
cleanDataFrame

Check and Clean data.frame for usage with variable key functions
colnamesReplace

Replace column names with new names from a named vector
deleteBogusRows

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

Discern nesting pattern of SEM coefficients
compareCFA

compareCFA
deleteBogusColumns

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

A variable is transformed in an indicated way
checkValues

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

Convert nothing to R missing(NA).
natlongsurv

Smoking, Happiness, and other survey responses
dms

Delete multiple slashes, replace with one
dts

Delete trailing slash
makeKeylist

Convert the variable key into a keylist structure for use in keyApply
reverse

Reverse the levels in a factor
safeInteger

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

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

Update packages, spot new dependencies, and install them
dev.create

Create a graphics device
dir.create.unique

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

Creates Structural Equation Modeling Tables
mgsub

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

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

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

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

Percentage tables for Likert Scale variables
long2wide

convert a key object from long to wide format
smartRead

read file after deducing file type from suffix.
keyChecker

Checks a variable key for possible errors.
keyDiagnostic

Diagnose accuracy of result from applying variable key to data
keyTemplate

Create variable key template
keyUpdate

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

Print the "changes" component of a keyDiagnostic object
is.data.frame.simple

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

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

Compares a key provided to keyUpdate with the return of keyUpdate
keyImport

Import a file and clean up for use as variable key
removeMatches

Remove elements if they are in a target vector, possibly replacing with NA
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.
starsig

How many stars would we need for this p value?
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.
smartSave

save file after deducing type from suffix
wide2long

Convert a key object from wide to long format
zapspace

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