我有以下文字数据:
hold that\nagainst me. i spend most of my days trying to build cool stuff for\nmy company. <br />\n<br />\ni'm an entrepreneur (like everyone else in sf, it seems) and i love\nwhat i do.
我使用了以下命令,但它只删除了\ n并且仍然保留。
gsub("\n <br />", " ", h)
当我尝试此命令时,两个字符都被删除,但实际文本数据中的“re”也被删除。所以,我想知道删除两者的正确方法是什么。
gsub("[\n <br />]", " ", h)
答案 0 :(得分:3)
enum
使用 text <- "hold that\nagainst me. i spend most of my days trying to build cool stuff for\nmy company. <br />\n<br />\ni'm an entrepreneur (like everyone else in sf, it seems) and i love\nwhat i do."
选择不同的模式((pat1|pat2)
仅适用于单字符替代方案)。
[]