Categorical data in R, or an improved factor