KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Related question here . So I have a character vector with currency values that contain both dollar signs and commas. However, I want to try and remove both the commas and dollar signs in the same step. This removes dollar signs = d = c("$0.00", "$10,598.90", "$13,082.47") gsub('\\$', '', d) This removes commas = library(stringr) str_replace_all(c("10,0","tat,y"), fixed(c(","), "") I'm wondering if I could remove both characters in one step. I realize that I could just save the gsub results into a new variable, and then reapply that (or another function) on that variable. But I guess I'm wondering about a single step to do both.
Tags (comma-separated)
Save Edits
Cancel