我有这个数据集:
dat<-read.table(text = "pl Freq
Abid 23
Berl 54
Cara 54
Daka 10",header=T)
我正在尝试使用每列的名称(在列下(即&#34; pl&#34;信息))和按降序排序的列的直方图... 我尝试了很多订购方法,但是:
barplot(dat$freq)
似乎不是好方法......
我有任何想法会有所帮助!
干杯,
R上。
答案 0 :(得分:3)
我相信这就是你要找的东西:
barplot(dat$Freq, names.arg = dat$pl)
如果你想根据频率对条形图进行分类:
dat <- dat[order(dat$Freq, decreasing = TRUE), ]
托马斯