【发布时间】:2020-07-04 09:49:04
【问题描述】:
我试图在r 的文本文件中查找所有包含任何格式数字的句子,并将其替换为它们周围的主题标签。
例如输入以下内容:
ex <- c("I have $5.78 in my account","Hello my name is blank","do you want 1,785 puppies?",
"I love stack overflow!","My favorite numbers are 3, 14,568, and 78")
作为函数的输出,我正在寻找:
> "I have #$5.78# in my account"
> "do you want #1,785# puppies?"
> "My favorite numbers are #3#, #14,568#, and #78#"
【问题讨论】:
标签: r r regex text-files gsub hashtag