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
  • 607,720
  • 39
  • 448
  • 563
Shuti
  • 169
  • 1
  • 4
  • 18

0 Answers0