test <- read.table(textConnection("age popperc 0-5 7 5-15 14 15-20 7 20-25 7 25-35 7 25-30 7 30-35 7 35-45 15 45-55 14 55-65 10 65-75 6 75-85 6"),header=TRUE,stringsAsFactors=FALSE) midval <- sapply(strsplit(test$age,"-"),function(x) mean(as.numeric(x))) breakval <- strsplit(test$age,"-") breakval <- as.numeric(c(sapply(breakval,head,1),tail(unlist(breakval),1))) hist(rep(midval,test$popperc),breaks=breakval)