Strings and Characters

String Functions

ActionFunction

Get string length

nchar(string)

Combine two strings

str_c(string1, string2)

Sort values within a string

sort(string1, string2, string3)

Inputs:

#String length
nchar("codiac")

#Combine strings
str_c("patient ", c("a", "b", "c"))

#Sort values in a string
x <- c("carrot", "apple", "banana")
sort(x)

Outputs:

#String length
6

#Combine strings
"patient a" "patient b" "patient c"

#Sort values in a string
"apple" "banana" "carrot"

Resources

Last updated