str_to_CamelCase: Convert 'string' to 'String', or 'this.string' to...

Description Usage Arguments Examples

View source: R/text_processing.R

Description

Based on https://stackoverflow.com/a/11672354/4272484

Usage

1
str_to_CamelCase(x, split = " ", collapse = "")

Arguments

x

Input character vector

split

Pattern/char(s) to split on

collapse

Char(s) to join with

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
t1 <- c('this text', 'next text')
t2 <- c('this.text', 'next.text')
t3 <- 'this'
t4 <- 'this text'

str_to_CamelCase(t1) # c('ThisText', 'NextText')
str_to_CamelCase(t1, collapse = ' ') # c('This Text', 'Next Text')
str_to_CamelCase(t2, split = '.', collapse = ' ') # c('This Text', 'Next Text')

str_to_CamelCase(t3) # 'This'
str_to_CamelCase(t4) # 'ThisText'

m-dz/mdmisc documentation built on May 22, 2019, 12:23 p.m.