zoukankan      html  css  js  c++  java
  • R语言学习笔记(二十):stringr包中函数介绍(表格)

    stringr包中的重要函数

    函数 功能说明 R Base中对应函数
    使用正则表达式的函数
    str_extract() 提取首个匹配模式的字符 regmatches()
    str_extract_all() 提取所有匹配模式的字符 regmatches()
    str_locate() 返回首个匹配模式的字符的位置 regexpr()
    str_locate_all() 返回所有匹配模式的字符的位置 gregexpr()
    str_replace() 替换首个匹配模式 sub()
    str_replace_all() 替换所有匹配模式 gsub()
    str_split() 按照模式分割字符串 strsplit()
    str_split_fixed() 按照模式将字符串分割成指定个数 -
    str_detect() 检测字符是否存在某些指定模式 grepl()
    str_count() 返回指定模式出现的次数 -
    其他重要函数
    str_sub() 提取指定位置的字符 regmatches()
    str_dup() 丢弃指定位置的字符 -
    str_length() 返回字符的长度 nchar()
    str_pad() 填补字符 -
    str_trim() 丢弃填充,如去掉字符前后的空格 -
    str_c() 连接字符 paste(),paste0()
  • 相关阅读:
    bzoj 5455
    hdu 6705
    hdu 6706
    斜率优化
    bzoj3672
    bzoj1367
    bzoj2118
    bzoj2337
    Codeforces 1077D Cutting Out(二分答案)
    Codeforces 1079C Playing Piano(记忆化搜索)
  • 原文地址:https://www.cnblogs.com/xihehe/p/8306182.html
Copyright © 2011-2022 走看看