具体而言,可以分两步重现问题。
(1)将this txt file加载到R with
中algae <- read.table('http://www.liaad.up.pt/~ltorgo/DataMiningWithR/DataSets/Analysis.txt',
header=F,
dec='.',
col.names=c('season','size','speed','mxPH','mnO2','Cl','NO3','NH4','oPO4','PO4','Chla','a1','a2','a3','a4','a5','a6','a7'),
na.strings=c('XXXXXXX'))
(2)用plot(algae$speed)
绘图。
分类值将按“高”,“低”,“中”排序。但是,我希望它们是“高”,“中”,“低”。这可能吗?
答案 0 :(得分:2)
试试这个:
algae$speed <- factor(algae$speed, levels=c("low", "medium", "high"))
plot(algae$speed)