是否可以轻松地从先前计算的统计图中绘制箱线图(在R中)? [英] Is it possible to plot a boxplot from previously-calculated statistics easily (in R?)
问题描述
我有许多来自各种数据集的摘要统计信息:最大值,最小值,均值,中位数等。我想绘制这些的箱形图-或至少与箱形图类似(我没有UQ和LQ统计信息,尽管有可能获得这些图)。
I have a number of sets of summary statistics from various datasets: max, min, mean, median etc. I'd like to plot box-plots of these - or at least, similar plots to boxplots (I don't have UQ and LQ stats, although it may be possible to get those).
我没有原始数据,所以我不能只在R中使用 boxplot
函数。当您只是在R中有一种简单的方法有汇总统计信息吗?如果不是,是否有简单的方法可以使用另一个免费工具来做到这一点?
I don't have the original data, so I can't just use the boxplot
function in R. Is there an easy way to do this in R when you just have the summary statistics? If not, is there an easy way to do this using another free tool?
推荐答案
R中的boxplot函数使用低称为摘要功能的bxp级功能。一个简单的示例(下胡须= 1,第一四分位= 2,中位数= 3,第三四分位= 4,上胡须= 5)看起来像这样:
The boxplot function in R uses a low-level function called bxp which accepts summary statistics. A simple example (lower whisker=1, 1st quartile=2, median=3, 3rd quartile=4, upper whisker=5) would look like this:
summarydata<-list(stats=matrix(c(1,2,3,4,5),5,1), n=10)
bxp(summarydata)
如果您想进一步了解bxp接受作为输入的数据结构,请查看某些伪数据的水平boxplot函数,即尝试
If you want to know more about the data structure that bxp accepts as input, look at the return value of the high-level boxplot function for some dummy data, i.e. try
sd<-boxplot(dummydata)
str(sd)
这篇关于是否可以轻松地从先前计算的统计图中绘制箱线图(在R中)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!