字符串分割函數
strsplit() ##strsplit(x,
split, extended = TRUE, fixed = FALSE, perl = FALSE)
strsplit('123abcderabggg','ab') #按照ab分割字符串
字符串連接:
paste() #paste(..., sep = " ", collapse = NULL)
paste() #paste(..., sep = " ", collapse = NULL)
計算字符串的字符數:
nachr()
字符串截取:
字符串替換及大小寫substr(x,start,stop)substring(test,fist,last = 1000000)
chartr(old,new,x) #將x中的a替換成c
tolower(x) #將大寫替換成小寫toupper(x) #將小寫替換成大寫casefold(x,upper = F)
字符完全匹配
grep() #查找出字符串在向量中的位置 當value爲T的時候 返回值grepl() #返回邏輯值
字符不完全匹配
agrep()
字符替換
gsub()
agrep()
字符替換
gsub()