0

I have processed percentile data (P25/P50/P75):

area1   25650   26300   26950
area2   45825   49000   55000
area3   32768   32768   32768

Can I make a base boxplot using this data in r?

Ben
  • 28,684
  • 5
  • 23
  • 45
Savi
  • 167
  • 1
  • 9
  • 1
    There are examples of creating boxplots from percentile data [here](https://stackoverflow.com/questions/11129432/draw-bloxplots-in-r-given-25-50-75-percentiles-and-min-and-max-values) and [here](https://stackoverflow.com/questions/10628847/geom-boxplot-with-precomputed-values). Is that what you're looking for? – Ben May 20 '20 at 13:30

1 Answers1

1

You can use the lower, middle and upper aesthetic mappings in ggplot:

library(ggplot2)
ggplot(data, aes(x=Group,
                 ymin = P25,
                 ymax = P75,
                 lower = P25,
                 middle = P50,
                 upper = P75,
                 fill = Group)) +
  geom_boxplot(stat = "identity")      

enter image description here

Data

data <- structure(list(Group = structure(1:3, .Label = c("area1", "area2", 
    "area3"), class = "factor"), P25 = c(25650L, 45825L, 32768L), 
        P50 = c(26300L, 49000L, 32768L), P75 = c(26950L, 55000L, 
        32768L)), row.names = c(NA, 3L), class = "data.frame")
Ian Campbell
  • 23,484
  • 14
  • 36
  • 57