Is it possible to plot a boxplot from previously-calculated statistics easily (in R?) [duplicate]

依然范特西╮ 提交于 2019-11-27 07:51:00

问题


Possible Duplicate:
Draw bloxplots in R given 25,50,75 percentiles and min and max values

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).

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?


回答1:


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)

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)


来源:https://stackoverflow.com/questions/11952819/is-it-possible-to-plot-a-boxplot-from-previously-calculated-statistics-easily-i

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