【发布时间】:2017-04-09 20:52:34
【问题描述】:
我正在尝试使用 gsub() 来清理 csv 格式的文本数据集。现在我的数据示例行如下:
"5.0\t/gp/customer-reviews/R3M62HO4M6LXE6?ASIN=0439023521\tEngaging. Brutal but engaging!\t\"Wow. I was barely able to put this book down for a second after the first few pages got me completely hooked.
我想删除没有提供任何内容的开始字符串并删除所有 \t\ 或 \t 以获得预期的结果,如
"Engaging. Brutal but engaging!"Wow. I was barely able to put this book down for a second after the first few pages got me completely hooked.
我尝试使用
gsub('\\t\\', "", comment, fix=TRUE)
删除 \t\ 但它没有工作。 而且开头的字符串太复杂了,我在编写正确的模式表达式时遇到了麻烦。
【问题讨论】:
-
“什么都不提供”?这是什么意思?
-
@WiktorStribiżew 这意味着非标准英文字符串确实包含我想要的任何信息..
-
但是
customer-reviews在我看来很标准
标签: r regex gsub data-cleaning