Population Pyramid ordering of agegroups

 HH_rep  <- data.frame(age = runif(n =1000, min = 0, max = 100),
+                  sex = sample(c("female", "male"), 1000, replace = TRUE))
> HH_rep$AGEcut <- cut(x = HH_rep$age, breaks = seq(0, 100, 5))
> levels(HH_rep$AGEcut) 
 [1] "(0,5]"    "(5,10]"   "(10,15]"  "(15,20]"  "(20,25]"  "(25,30]"  "(30,35]"  "(35,40]"  "(40,45]" 
[10] "(45,50]"  "(50,55]"  "(55,60]"  "(60,65]"  "(65,70]"  "(70,75]"  "(75,80]"  "(80,85]"  "(85,90]" 
[19] "(90,95]"  "(95,100]"
>