im new to R and working on data cleaning and i have a column of Values of football players in my dataframe df with the following notations
df$Value <- c("€110.5M", "€1M", "€200k", "€ 0", "€52M")
I would like to convert this column into either just integers or if a currency type exists into that. I later want to compare them in a plot. I have tried to solve it with something like this:
library(stringr)
df$Value<- str_remove_all(df$Value, "[€]")
df$Value<- str_replace_all(df$Value, "[K]", "000")
df$Value<- strtoi(df$Value)
But this doesn't seem to be a smart way and i dont know how to deal with the decimal places like "€1.5M"