Produces on-level factors in R