從R中的字符串中提取最后n個(gè)字符如何從R中的字符串中獲取最后n個(gè)字符?有沒有像SQL一樣的功能?
3 回答

守候你守候我
TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊
以防萬一需要挑選一系列字符:
# For example, to get the date part from the stringsubstrRightRange <- function(x, m, n){substr(x, nchar(x)-m+1, nchar(x)-m+n)}value <- "REGNDATE:20170526RN" substrRightRange(value, 10, 8)[1] "20170526"
- 3 回答
- 0 關(guān)注
- 5412 瀏覽
添加回答
舉報(bào)
0/150
提交
取消