13

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?

Community
  • 1
  • 1
robintw
  • 27,571
  • 51
  • 138
  • 205
  • 1
    As this is a R-specific programming question, stackoverflow may have been the more suitable site (there's an [r] tag at SO, too). – cbeleites unhappy with SX May 04 '12 at 06:10
  • It doesn't read like an R-specific question to me: it seeks a method to draw boxplots from summary statistics. – whuber May 04 '12 at 14:17
  • This is a duplicate. I like [this question](http://stackoverflow.com/questions/11129432/draw-bloxplots-in-r-given-25-50-75-percentiles-and-min-and-max-values), but it was closed as a duplicate of [this question](http://stackoverflow.com/questions/10628847/geom-boxplot-with-precomputed-values) – GSee Aug 14 '12 at 13:05

1 Answers1

23

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)
psj
  • 346
  • 2
  • 3