June 2017
Beginner to intermediate
576 pages
15h 22m
English
This is a simple example use of this function that maps the two character vector c("A certain good book", "A very easy book") to camelcase. This vector is mapped to two new elements:
[1] "ACertainGoodBook", and [2] "AVeryEasyBook"
# change descriptions to camelcase maybe append to itemnumber for uniqueness.simpleCap <- function(x) { # s <- strsplit(x, ' ')[[1]] s <- strsplit(tolower(x), " ")[[1]] aa <- paste(toupper(substring(s, 1, 1)), substring(s, 2), sep = "", collapse = " ") gsub(" ", "", aa, fixed = TRUE)}
a <- c("A certain good book", "A very easy book")a4 <- gsub(" ", "", .simpleCap(a), fixed = TRUE)a4
> [1] "ACertainGoodBook"
lapply(a, .simpleCap)
> [[1]]> [1] "ACertainGoodBook"> > [[2]]> [1] "AVeryEasyBook" ...