微信添加CDA为好友(ID:joinlearn1),拉你入500人数据分析师交流群,点击阅读原文可查看CDA数据分析师交流群规范与福利,期待你来~
str_to_upper(string, locale = “”)
str_to_lower(string, locale = “”)
str_to_title(string, locale = “”)
fixed(pattern, ignore_case = FALSE):Compare literal bytes in the string. This is very fast, but not usually what you want for non-ASCII character sets.
coll(pattern, ignore_case = FALSE, locale = NULL, …):Compare strings respecting standard collation rules.
regex(pattern, ignore_case = FALSE, multiline = FALSE, comments = FALSE, dotall = FALSE, …):默认使用正则表达式
boundary(type = c(“character”, “line_break”, “sentence”, “word”), skip_word_none = TRUE, …):Match boundaries between things.
pattern: Pattern to modify behaviour.
ignore_case: Should case differences be ignored in the match?
locale: Locale to use for comparisons. See stri_locale_list() for all possible options.
…: Other less frequently used arguments passed onto stri_opts_collator, stri_opts_regex, or stri_opts_brkiter
multiline: If TRUE, $ and ^ match the beginning and end of each line. If FALSE, the default, only match the start and end of the input.
comments: If TRUE, whitespace and comments beginning with # are ignored. Escape literal spaces with \ .
dotall: If TRUE, . will also match line terminators.
type: Boundary type to detect.
skip_word_none: Ignore “words” that don’t contain any characters or numbers - i.e. punctuation.
str_c(…, sep = “”, collapse = NULL)
str_join(…, sep = “”, collapse = NULL)
str_conv(string, encoding)
str_count(string, pattern = “”)
str_detect(string, pattern)
str_dup(string, times)
str_extract(string, pattern) 提取匹配的第一个字符串
str_extract_all(string, pattern, simplify = FALSE) 提取匹配的所有字符串
str_locate(string, pattern):返回匹配的第一个字符串的位置
str_locate_all(string, pattern):返回匹配的所有位置
str_match(string, pattern) 提取匹配的第一个字符串
str_match_all(string, pattern) 提取匹配的所有字符串
13. str_order 对字符向量进行排序
str_order(x, decreasing = FALSE, na_last = TRUE, locale = “”, …)
str_sort(x, decreasing = FALSE, na_last = TRUE, locale = “”, …)
width:填充字符后字符串的长度;
side:填充字符串的位置,默认为left;
pad:指定填充的字符串;
str_replace(string, pattern, replacement)
str_replace_all(string, pattern, replacement)
str_replace_na(string, replacement = “NA”)
str_split(string, pattern, n = Inf)#结果返回列表
str_split_fixed(string, pattern, n)#结果返回矩阵
str_sub(string, start = 1L, end = -1L) 提取子字符串
str_sub(string, start = 1L, end = -1L) <- value 替换子字符串
str_subset(string, pattern)
str_trim(string, side = c(“both”, “left”, “right”))
width:每行的宽度
indent:设置首行缩进
exdent:设置第二行后每行缩进
word(string, start = 1L, end = start, sep = fixed(“ “))
split:设置分割符
fixed:逻辑值,默认值为FALSE
perl:逻辑值,默认值为FALSE,取TRUE时,分割符使用正则表达式
useBytes:逻辑值,默认值为FALSE,
nchar(x, type = “chars”, allowNA = FALSE)
ignore.case:逻辑值,默认值FALSE,区分大小写;
perl:逻辑值,默认值FALSE,不使用正则表达式;
value:逻辑值,设置结果返回匹配元素的值还是索引,默认值为FALSE:返回索引;
fixed:逻辑值,默认值为FALSE,取值为TRUE时使用精确匹配;
useBytes:逻辑值,默认取值FALSE;
invert:逻辑值,默认取值FALSE,设置结果返回匹配还是非匹配的元素;
(2) grepl(pattern, x, ignore.case = FALSE, perl = FALSE, fixed = FALSE, useBytes = FALSE),结果返回一个与向量x等长的逻辑向量,匹配的元素返回TRUE,不匹配的返回FALSE。
来源 | 数据人网
原文链接:http://shujuren.org/article/162.html
点击阅读原文可查看CDA数据分析师交流群规范与福利


