如何从R中的字符串中提取字符?
我们可以在stringi包中使用stri_sub函数。
示例
> x<- "nhooo is the largest online library for best tutorials"> x
[1] "nhooo is the largest online library for best tutorials"
> library(stringi)
> stri_sub(x,1,9)
[1] "Tutorials"
> stri_sub(x,1,-20)
[1] "nhooo is the largest online library"
> stri_sub(x,-14,-1)
[1] "best tutorials"
> stri_sub(x,-41,-1)
[1] "largest online library for best tutorials"
以上是 如何从R中的字符串中提取字符? 的全部内容, 来源链接: utcz.com/z/341014.html