I'm pretty brand new to R and having an issue with a data frame.
So i have a dataframe dataf that looks like this:
# PlayerName playerValue
#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 Jamal Blackman 500 Th. €
Then I use the line:
dataf$playerValue <- gsub(",", ".", gsub("[[:space:]].*", "", dataf$PlayerValue))
The output of this is:
# PlayerName playerValue playerValue
#5 Tammy Abraham 10,00 Mill. € 10
#6 Abdul Rahman Baba 8,00 Mill. € 8
#7 Mario Pasalic 8,00 Mill. € 8
#8 Lewis Baker 5,50 Mill. € 5.5
#9 Ola Aina 4,00 Mill. € 4
#10 Jamal Blackman 500 Th. € 500
Is there anyway to make the final value from 500 to .5? Because obviously 500 thousand is smaller than 4 million, but here the int 500 is going to be larger than 4.
Also, how do I just exclude the original PlayerValue column? When I run my code it prints out the column twice, once with the String at the end and the converted column too.
Thank you for any help.