Confusion between factor levels and factor labels
There seems to be a difference between levels and labels of a factor in R. Up to now, I always thought that levels were the 'real' name of factor levels, and labels were the names used for output (such as tables and plots). Obviously, this is not the case, as the following example shows: df <- data.frame(v=c(1,2,3),f=c('a','b','c')) str(df) 'data.frame': 3 obs. of 2 variables: $ v: num 1 2 3 $ f: Factor w/ 3 levels "a","b","c": 1 2 3 df$f <- factor(df$f, levels=c('a','b','c'), labels=c('Treatment A: XYZ','Treatment B: YZX','Treatment C: ZYX')) levels(df$f) [1] "Treatment A: XYZ" "Treatment B: