mode
to identify the type characternchar()
: Finds the length of a string.substring()
: Extracts substrings and substitutes.strsplit()
: Turns strings into vectors.paste()
: Turns vectors into a string.grep()
: Search for patterns in a string.mode(" ")
# return: "character"
nchar(" "); nchar(" "); nchar("");
# the number of characters here is:
# 1 2 0
If strings are elements of an object,
length()
reports the number of strings in the object, not the number of characters in the string.nchar()
reports the number of character values in a string.