Description Usage Arguments See Also Examples
Removes leading and trailing whitespace from every column in a dataframe or list of dataframes. At the same time it standardizes the case of the characters to either upper or lower case. This function works best with raw character data before converting data types and other data munging/feature engineering. Does handle a dataframe as it is, however, and returns every column in it's original data type as a dataframe.
1 2 |
df |
a dataframe or list of dataframes with columns of any character type |
case |
the letter case you want the output to be: |
colclasses |
do you want to return every column to it's original data type ( |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | df <- data.frame(
performingPhysio = c(
"JILL jones "
, " jack BLACK"
, ""
, " RegiNald ChesterField "
)
, "operating Physio" = c(
"Who Dat "
, "chuck FLEMMING "
, NA
, " shankman
, razor shankman"
)
, consent = rep(FALSE, times = 4)
, duration_hrs = 5:8
, stringsAsFactors = FALSE
)
casetrim(df)
casetrim(
df
, case = 'lower'
)
casetrim(
df
, case = 'lower'
, colclasses = 'character'
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.