STRING MANIPULATION IN R
String manipulation in R involves the modification, analysis and transformation of text data, including actions such as substring extraction, pattern searching, replacement, concatenation and formatting changes to strings
![The nchar function in R](/images/featured/nchar-r.png)
Count the number of characters with nchar()
nchar() nzchar()
![Concatenate strings in R with paste and paste0 functions](/images/featured/paste-r.png)
Concatenate strings with paste() and paste0()
paste() paste0()
![Print values in R with the print(), sprintf(), cat() and noquote() functions](/images/featured/print-r.png)
Print formatted values with sprintf()
sprintf()
![Lowercase and uppercase in R with tolower(), toupper() and chartr()](/images/featured/tolower-toupper-r.png)
Lowercase and uppercase with tolower() and toupper()
tolower() toupper() casefold() chartr()
![The strsplit() function in R](/images/featured/strsplit-r.png)
Split strings with strsplit()
strsplit()
![The substring() and substr() functions in R](/images/featured/substring-r.png)
Extract and replace substrings with substring() and substr()
substring() substr()
![Remove leading or trailing whitespaces in R with trimws()](/images/featured/trimws-r.png)
Remove leading and/or trailing whitespaces with trimws()
trimws()
![Pattern matching in R](/images/featured/grepl-grep-r.png)
Pattern matching with grepl() and grep()
grepl() grep()
![Pattern matching and replacement in R](/images/featured/gsub-sub-r.png)
Pattern matching and replacement with gsub() and sub()
gsub() sub()