I have a factor variable represented by the histogram bins with values: ‘660-664’ , … , ‘740-744′ , 745-749’ ..
How can I map the factor variable to its mean value, e.g mapping ‘660-664’ to 662?
Basically, what I’m looking for is the inverse of the “cut” function.
You can make use of the
plot = FALSEargument fromhistto extract the breaks, then use that to get your midpoints:Update: Calculating the mean from a character string of ranges
Judging by your comments, you might be looking for something more like this: