R programming | Character and string functions in R

Опубликовано: 06 Июль 2026
на канале: rdatacode
132
1

R programming Section 4. Advanced data management. Lecture 4. Character and string functions in R.


Common character functions
toupper(y) Uppercase
tolower(y) Lowercase
sub(pattern, replacement, Y, ignore.case=FALSE, fixed=FALSE)
Finds pattern in Y and substitutes the replacement text
nchar(Y) Counts the number of characters of Y
paste(..., sep="") Concatenates strings after using specified sep string
substr(Y, start, stop) Extracts substrings in a character vector
grep(pattern, Y, ignore.case=FALSE,fixed=FALSE)
Searches for pattern in Y and Returns the matching indices
strsplit(Y, split, fixed=FALSE)
Splits the elements of character vector Y at split




#rprogramming
#rstudio
#string
#character
#function
#rdatacode