0

I have a dataframe L with column price that I store in variable pr. I want to remove the "$" from the price column and then turn it into numeric. How do I do this please? I tried as followed.

This is my column before:

columnBefore

I tried this code:

pr = L$price
pr <- gsub("$", "", pr)
pr

But, instead of removing "$", it adds "" to the data

columnAfter

Could you please let me know how I can do this? Thank you in advance.

Wiktor Stribiżew
  • 561,645
  • 34
  • 376
  • 476
Shuti
  • 119
  • 2
  • 14

0 Answers0