> tmp = strsplit(as.character(colname[i, ]),'[0-9]') # 先拆分出想要的子字符串
> tmp
[[1]]
[1] "" ""
[3] " - " ""
[5] " Players name (in quotation marks)"
> ind = grep("[A-Z]", tmp[[1]]) # 再定位
> ind
[1] 5
> print(paste("i",i,"tmp",tmp[[1]][ind])) # 提取
[1] "i 18 tmp Players name (in quotation marks)"
【R语言】正则表达式提取特定字符串
最新推荐文章于 2024-08-17 16:06:18 发布