Description Usage Arguments Details Value Examples
This function combines several ways titles and names may need to be formatted. It's meant to be simple, yet flexible.
1 2 3 4 5 6 7 8 |
x |
A character vector |
cap_all |
Logical: if |
split_case |
Logical: if |
keep_running_caps |
Logical: if |
space |
Character vector of characters and/or regex patterns that should be replaced with a space to separate words. |
remove |
Character vector of characters and/or regex patterns that will be removed before any other operations; if |
Examples of possible common operations include:
"TownName" –> "Town Name"
"town_name" –> "Town Name"
"town_name" –> "Town name"
"RegionABC" –> "Region ABC"
"TOWN_NAME" –> "Town Name"
A character vector with each item newly formatted
1 2 3 4 5 6 7 8 9 10 11 12 | t1 <- c("GreaterNewHaven", "greater_new_haven", "GREATER_NEW_HAVEN")
clean_titles(t1, cap_all = TRUE, keep_running_caps = FALSE)
t2 <- c("Male!CollegeGraduates", "Male CollegeGraduates")
clean_titles(t2, space = c("_", "!"))
t3 <- c("Greater BPT Men", "Greater BPT Men HBP", "GreaterBPT_men", "greaterBPT")
clean_titles(t3, cap_all = FALSE)
t4 <- c("New Haven town, New Haven County, Connecticut",
"Newtown town, Fairfield County, Connecticut")
clean_titles(t4, cap_all = TRUE, remove = " town,.+")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.