I am working on analysing some data using wage variables. The variable contains symbol '€' and 'M' or 'K'.
I was trying to use gsub() function to address this issue, yet my code doesn't work
Integer_converter <- function(strWage) {
Factor_Wage = gsub("€", " ", strWage)
}
Factor_converter_1 <- function(strWage) {
Integer_Wage = gsub("M", " ", strWage)
}
Factor_converter_2 <- function(strWage) {
Integer_wage = as.integer(as.integer(gsub("K", "", strWage)) / 100)
}
The actual values are listed as follows:
$ Wage /fct/ €405K, €195K, €205K, €240K, €175K, €25K, €205K, €57K, €140K, €135K, €15K, €45K, €40K, €76K, €17K, €125K, …
and I want to convert it into
$ Wage /int/ 0.405, 0.195, 0.205, 0.240, 0.175, 0.025, 0.205, 0.057, 0.140, 0.135, 0.015, 0.045, 0.040, 0.076, 0.017, 0.125, …enter image description here