I have dataframe dataf with column PlayerValue
PlayerName playerValue
1 Michy Batshuayi 40,00 Mill. €
2 Tiemoué Bakayoko 35,00 Mill. €
3 Kurt Zouma 20,00 Mill. €
4 Kenedy 10,00 Mill. €
5 Tammy Abraham 10,00 Mill. €
6 Abdul Rahman Baba 8,00 Mill. €
7 Mario Pasalic 8,00 Mill. €
8 Lewis Baker 5,50 Mill. €
9 Ola Aina 4,00 Mill. €
10 Tomas Kalas 4,00 Mill. €
I would like to make it get just the number (and if possible replace the comma with a decimal point) in the column like this
PlayerName playerValue
1 Michy Batshuayi 40,00 # 40.00, if possible
2 Tiemoué Bakayoko 35,00
3 Kurt Zouma 20,00
4 Kenedy 10,00
5 Tammy Abraham 10,00
6 Abdul Rahman Baba 8,00
7 Mario Pasalic 8,00
8 Lewis Baker 5,50
9 Ola Aina 4,00
10 Tomas Kalas 4,00
"##,## Mill. €"format you can simply replace the non-numeric parts with blank character"". As inlibrary(stringr); x <- str_replace(x, " Mill. €", ""); x <- str_replace(x, ",", "")But to cover more complicated cases you should first replace the comma with""and then use regular expressions (also supported bystringrfunctions) to detect only numeric parts