如
strsplit ( '123abcdefgabcdef' , 'ab' )
[[ 1 ]]
[ 1 ]
#字符串连接:
paste ()
#字符串分割:
strsplit ()
#计算字符串的字符数:
nchar ()
#字符串截取:
substr (x,
substring ( text , first, last =
substr (x,
substring ( text , first, last =
###########例子说明
substr("abcdef",2,4)
substring("abcdef",1:6,1:6)## strsplit is more efficient ...
substr(rep("abcdef",4),1:4,4:5)
x <- c("asfef", "qwerty", "yuiop[", "b", "stuff.blah.yech")
substr(x, 2, 5)substring(x, 2, 4:6)
substring(x, 2) <- c("..", "+++")
x
###########
#字符串替换及大小写转换:
chartr (old,
tolower (x)
toupper (x)
casefold (x, upper =
字符完全匹配
grep ()
字符不完全匹配
agrep ()
字符替换
gsub ()
#以上这些函数均可以通过perl=TRUE来使用正则表达式。
See Also: