Tag: 等级

`水平<-`(这是什么巫术?

在回答另一个问题时,@Marek发布了以下解决scheme: https ://stackoverflow.com/a/10432263/636656 dat <- structure(list(product = c(11L, 11L, 9L, 9L, 6L, 1L, 11L, 5L, 7L, 11L, 5L, 11L, 4L, 3L, 10L, 7L, 10L, 5L, 9L, 8L)), .Names = "product", row.names = c(NA, -20L), class = "data.frame") `levels<-`( factor(dat$product), list(Tylenol=1:3, Advil=4:6, Bayer=7:9, Generic=10:12) ) 作为输出产生: [1] Generic Generic Bayer Bayer Advil Tylenol Generic Advil Bayer […]