R boxplot frequency

南楼画角 提交于 2019-12-02 16:31:56

问题


I'm in need of assistance... I'm using R to analyze some data... I have a frequency table called mytable... that I created like this:

mytable=table(cut(var1,12),cut(var2,12))

the table looks something like this:

       1-2  2-3  3-4
1-3     2    1    2
3-6     0    1    4
6-9     7    1    8

except is a 12 by 12 table.

I used boxplot.matrix(mytable),the boxplot looks ok... with the 12 boxes corresponding to my 12 stratums, but my boxplot has the frequency as the y-axis and I want the y-axis to be the values from var1, how can I do this?

I wanted to post a pic... but my rep wasnt high enough


回答1:


use boxplot before you summarize your data.

boxplot(var1)

If you want to see the distribution per split, use the formula format:

boxplot(var1 ~ cut(var2, 12))


来源:https://stackoverflow.com/questions/19594259/r-boxplot-frequency

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!