Learn R Programming

kutils (version 1.73)

Project Management Tools

Description

Tools for data importation, recoding, and inspection. 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.7, the function 'semTable' is removed. It was deprecated since 1.67. That is provided in a separate package, 'semTable'.

Copy Link

Version

Install

install.packages('kutils')

Monthly Downloads

12,573

Version

1.73

License

GPL-2

Maintainer

Paul Johnson

Last Published

September 17th, 2023

Functions in kutils (1.73)

deduper

Removes redundant words from beginnings of character strings
dev.create

Create a graphics device
deleteBogusRows

Remove rows in which the proportion of missing data exceeds a threshold.
dir.create.unique

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

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

Delete multiple slashes, replace with one
deleteBogusColumns

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

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

Delete trailing slash
importQualtrics

Import Qualtrics survey files, apply clean column names
isNA

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

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

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

Create project directories, initialize a git repo, create README.md ChangeLog, and R template file in R directory
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)
keyCheck

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

keyCrossRef
keyDiagnostic

Diagnose accuracy of result from applying variable key to data
keyDiff

Show difference between 2 keys
keyRead

Read file after deducing file type from suffix.
likert

Percentage tables for Likert Scale variables
keyUpdate

Update a key in light of a new data frame (add variables and values)
keysPool

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

convert a key object from long to wide format
keySave

Save key as file after deducing type from suffix
keyTemplate

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

Import a Stata (version 12 or lower) file, create a key representing the numeric -> factor transition
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.
keyTemplateSPSS

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

Convert nothing to R missing(NA).
naLast

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

First draft of function to diagnose problems in merges and key variables
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.
print.keyDiff

Print a keyDiff object
modifyVector

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

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

Smoking, Happiness, and other survey responses
makeKeylist

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

Show variables, one at a time, QUICKLY and EASILY.
removeMatches

Remove elements if they are in a target vector, possibly replacing with NA
print.keycheck

Print out the result of mergeCheck function.
print.likert

print method for likert tables
starsig

How many stars would we need for this p value?
shorten

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

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

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

Reverse the levels in a factor
qualtricsBlockStack

Create meta data frame to align identical questions
sortStanza

Move missing values to last row in long key block
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.
writeCSV

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

Convert a key object from wide to long format
truncsmart

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

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

Update packages, spot new dependencies, and install them
varlabTemplate

Create Variable Label Template
colnamesReplace

Replace column names with new names from a named vector
checkValue_old

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

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

Keep only alpha-numeric symbols
all.equal.key

An all.equal method for variable wide keys
anonomize

Create unique anonymous id values
assignMissing

Set missing values
assignRecode

A variable is transformed in an indicated way
cleanDataFrame

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

An all.equal method for variable long keys