"c", "a", "b", "c")! > factor_abc<-factor(abc)! > factor_abc! [1] a b c c a b c a c a b c! Levels: a b c! > abc_values<-c(1,2,3,5,7,6,8,5,4,5,2,6)! > sort(factor_abc)! [1] a a a a b b b c c c c c! Levels: a b c! > tapply(abc_values,factor_abc,mean)! a b c ! 4.500000 3.333333 5.200000 ! > temperature<-c("High","Low","High","Low","Medium")! > factor_temperature<-factor(temperature,order=TRUE,levels=c("Low","Medium","High"))! > factor_temperature! [1] High Low High Low Medium! Levels: Low < Medium < High! > summary(factor_abc)! a b c ! 4 3 5 ! > summary(factor_temperature)! Low Medium High ! 2 1 2 ! ! Factor