Description Usage Arguments Details Value Author(s) Examples
View source: R/clean_col_content.R
It cleans column content (my relative definition of 'clean'). Specifically, it separates with underscore (e.g., "pikaPika" to "pika_Pika"), replaces blank spaces with underscore, replaces multiple symbols with single underscore, and removes symbols after last word. These steps are followed IN THAT ORDER. It acts in character and factor variables. It gives a warning message if it is a factor. It does nothing to vectors other than character and factors.
1 | clean_col_content(x, warning_msg = TRUE)
|
x |
A factor of character vector. |
warning_msg |
Logical. Turn on and off warning message for factors |
It is basically the same as clean_colnames
. The idea
is that they do slightly different things in the future. The
difference is that clean_colnames
gives a warning
for repeated column names while clean_col_content
gives
instead a warning if the column is a factor.
A cleaner character of factor (same type as x
).
Guillermo Basulto-Elias
1 2 3 4 5 6 7 8 9 10 11 12 | clean_col_content(c("bart Simpson", "LisaSimpson",
"maggie..simpson!",
"MARGE-Simpson", "Homer Simpson :-)"))
## Get warning for factors.
## Not run:
clean_col_content(
factor(c("bart Simpson", "LisaSimpson",
"maggie..simpson!", "MARGE-Simpson",
"bart Simpson", "Homer Simpson :-)")))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.