R箱图频率 [英] R boxplot frequency
问题描述
我需要帮助...我正在使用 R 分析一些数据...我有一个频率表,称为mytable,我是这样创建的:
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))
表看起来像这样:
1-2 2-3 3-4
1-3 2 1 2
3-6 0 1 4
6-9 7 1 8
除外,这是一个12 x 12的表格。
except is a 12 by 12 table.
我使用了 boxplot.matrix(mytable)
,该箱形图看起来还可以...与对应的12个框我的12个层,但是我的箱线图以频率作为y轴,我希望y轴是var1中的值,我该怎么做?
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
推荐答案
使用 boxplot
,然后再汇总数据。
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))
这篇关于R箱图频率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!