The next question is here .
So, I have a character vector with currency values โโthat contain dollar signs and commas. However, I want to try to remove both the comma and dollar signs in the same step.
This removes the dollar signs =
d = c("$0.00", "$10,598.90", "$13,082.47") gsub('\\$', '', d)
This removes the commas =
library(stringr) str_replace_all(c("10,0","tat,y"), fixed(c(","), "")
I am wondering if I can remove both characters in one step.
I understand that I can just save the gsub results to a new variable and then reapply this (or another function) to this variable. But I think I'm wondering how to take the same step.
r stringr
ATMathew
source share