-1

我的数据是收入最大的 50 家公司。我有他们的员工人数,但我无法在图表中显示,因为他们都有不同数量的员工。如何对图表进行排序以将公司分组?

例如:3 家公司的员工人数在 1 到 50k 之间,5 家公司在 50k 到 100k 之间等。

到目前为止,我有:

plot(table(data$Employee),type="h",xlab="Number of employee", 
     ylab="Employees", main="50 largest companies")

但这没有意义,因为它为每个员工计数显示 1。

编辑

这是我的数据:

http://pastebin.com/2mBTdQ0b

员工部分接近尾声

4

1 回答 1

1

听起来您正在寻找员工人数的直方图。看一下?hist。这是一个例子

empl_count <- sample(1:500000,50)
yourbreaks <- seq(0,500000,by=50000)
x <- hist(empl_count,breaks=yourbreaks,plot=F)
x
plot(x, freq=T, axes=F,xlab="Number of employees in thousands", ylab="Frequency",main="50 largest companies")
axis(1,at=yourbreaks,labels=yourbreaks/1000,las=2)
axis(2,at=x$counts,labels=x$counts,las=1)
于 2013-11-03T01:30:27.770 回答