【发布时间】:2021-12-27 08:31:20
【问题描述】:
我想替换以美元符号开头的字符串的所有元素。 在这里你可以找到我的例子:
my_string <- "$AAPL $TSLA I recomend to buy $TLSA and to sell $AAPL; the price is rising to $12.56"
替换的是单词"cashtag"。
这是我想要的输出:
my_string
"cashtag cashtag I recomend to buy cashtag and to sell cashtag; the price is rising to $12.56"
我已经用str_replace_all 和startsWith 试过了。
但到目前为止,我还没有找到解决方案。
对于使用 tidyverse 包的建议解决方案,我也会非常高兴。
【问题讨论】: