I want to clean special characters from variable.
mm = data.frame(rule = c('$X <= 0', '$X > 0 & $X <= 17.5', '> 17.5 & $X <= 197.3', '$X > 197.3'))
mm$ruleclean <- gsub('\\&','',gsub('\\s+','',gsub('\\$X', '', mm$rule)))
Desired Output:
<=0
0 - 17.5
17.5 - 197.3
> 197.3
Objective is to convert it into intervals