1.
paste()
strsplit()
例如.
strsplit('123abcdefgabcdef','ab') [[1]] [1] "123" "cdefg" "cdef"
nchar()
substr(x, start, stop) substring(text, first, last = 1000000) substr(x, start, stop) <- value substring(text, first, last = 1000000) <- value
chartr(old, new, x) tolower(x) toupper(x) casefold(x, upper = FALSE)
#匹配相关的函数:
字符完全匹配 grep() 字符不完全匹配 agrep() 字符替换 gsub()
grep(pattern, x, ignore.case = FALSE, extended = TRUE, perl = FALSE, value = FALSE, fixed = FALSE, useBytes = FALSE)
sub(pattern, replacement, x, ignore.case = FALSE, extended = TRUE, perl = FALSE, fixed = FALSE, useBytes = FALSE)
gsub(pattern, replacement, x, ignore.case = FALSE, extended = TRUE, perl = FALSE, fixed = FALSE, useBytes = FALSE)
regexpr(pattern, text, ignore.case = FALSE, extended = TRUE, perl = FALSE, fixed = FALSE, useBytes = FALSE)
gregexpr(pattern, text, ignore.case = FALSE, extended = TRUE, perl = FALSE, fixed = FALSE, useBytes = FALSE) See Also:
regular expression (aka 'regexp') for the details of the pattern specification.
'glob2rx' to turn wildcard matches into regular expressions.
'agrep' for approximate matching.
'tolower', 'toupper' and 'chartr' for character translations. 'charmatch', 'pmatch', 'match'. 'apropos' uses regexps and has nice examples.
|
请发表评论