munge: Munge

Description Usage Arguments Details Value Examples

Description

Quick and dirty simple munging for data frames with mostly character data.

Usage

1

Arguments

df

matrix or data table

Details

Note - if this throws the error "Error in FUN(X[[i]], ...) : invalid multibyte string 203", you've got some weird characters in your dataset. Add ' fileEncoding="latin1 ' to the end of your read.csv line for the data frame that you read in.

many thanks to this stack overflow answer: http://stackoverflow.com/questions/17964513/subset-variables-in-data-frame-based-on-column-type

Value

lowercase data frame with white space trimmed. numeric, Date, and integer columns are left alone.

Examples

1
2
3
4
df = data.frame(number = numeric(c(1,2,3)),
     characternumber = c("one ", " TwO", "ThrEe"),
     city = c(" Memphis", "MEMPHIS", "memphis "))
munge(df)

brooke-watson/thesis documentation built on May 13, 2019, 7:50 a.m.