标签: r string gsub
我有一个带有列价格的数据框L,我将其存储在变量pr中。我想从价格列中删除“ $”,然后将其转换为数字。我该怎么做?我尝试了如下。
这是我之前的专栏文章
columnBefore
我尝试了以下代码:
pr = L$price pr <- gsub("$", "", pr) pr
但是,它没有删除“ $”,而是在数据中添加了“”。
columnAfter
请让我知道我该怎么做?预先谢谢你。