I have the followed column structure:
[9] "€10-€20" "€10-€60" "€6-€12" "€3-€10"
[737] "CHF 11-CHF 36" "CHF 3-CHF 10" "CHF 4-CHF 9" "CHF 6-CHF 25"
I want to convert the values in the column to a numeric value containing the average of the values:
[9] 15 35 9 6.5
[737] 23.5 6.5 6.5 15.5
Code for reproduction :
example <- c("€10-€20","€10-€60","€6-€12","€3-€10",
"CHF 11-CHF 36","CHF 3-CHF 10","CHF 4-CHF 9","CHF 6-CHF 25")
dt <- data.table(example)