简介
尽管 R 中字符串的处理应用场景较少,但仍需要具备一定字符处理的基础。tidyverse 中提供了 stringr 包进行字符处理。
字符处理的核心是正则表达式。
检测
str_detect()
连接
str_c()
取子集
str_sub()
匹配替换
str_replace()
str_replace_all()
尽管 R 中字符串的处理应用场景较少,但仍需要具备一定字符处理的基础。tidyverse 中提供了 stringr 包进行字符处理。
字符处理的核心是正则表达式。
str_detect()
str_c()
str_sub()
str_replace()
str_replace_all()