我想提取以文本文件中的"i“开头的行。
我试过这个
i <- grep("^i.", text,value = TRUE)提取包括iii和ii在内的所有谱线。如何解决这个问题?
数据
"i. provides substantial identification and comment upon significant aspects of texts \\"
"ii. provides substantial identification and comment upon the creator\\'92s choices \\"
"iii. sufficiently justifies opinions and ideas with examples and explanations; uses accurate terminology 发布于 2015-08-19 02:45:33
我们需要将.转义为字符.。否则,它就意味着任何角色。
grep('^i\\.', text, value=TRUE)
#[1] "i. provides substantial identification and comment upon significant aspects of texts \\"数据
text <- c("i. provides substantial identification and comment upon significant aspects of texts \\",
"ii. provides substantial identification and comment upon the creator\\'92s choices \\",
"iii. sufficiently justifies opinions and ideas with examples and explanations; uses accurate terminology ")https://stackoverflow.com/questions/32085670
复制相似问题