0

I want to find the summary statistics(Min,Max,Median,Q1 & Q3 behind my boxplot as well as std.dev, mean, variance. I removed outliers so summary(txdata2) doesn't quite work.

I've attempted using summary_stat() and just the stat() functions, but I likely am using them incorrectly.

txplot <- ggplot(data = txdata2,aes(x= inputx,y= inputy,))


txplot +
  geom_jitter(aes(size = ML.S, color = BPR.GRP.A)) +
  geom_boxplot(alpha = 0.6, outlier.colour = "NA") +

  #Nondata Ink
  xlab("BPR Group") +
  ylab("mL's Per Order") +
  ggtitle("Sales Concentrations") +
  facet_grid(FISCAL.YR~.) +
  coord_cartesian(ylim = c(0,250))
Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294
Adam
  • 1
  • 1
  • This this [answer] (https://stackoverflow.com/questions/28173284/extract-statistics-from-boxplot) – Kris Sep 26 '19 at 16:14
  • Try calling plot$stats: See this [answer]https://stackoverflow.com/questions/28173284/extract-statistics-from-boxplot) – Kris Sep 26 '19 at 16:16
  • 1
    `outlier.colour = NA` will make it so outliers aren't plotted as points, it doesn't remove them from the data before calculating the stats, so `summary(txdata2)` should work just fine. Or, perhaps something like `with(txdata2, by(inputy, list(inputx, FISCAL.YR), summary))` – Gregor Thomas Sep 26 '19 at 16:16
  • 1
    @Kris you might want to edit your comments, they both start with a "How to answer" link which doesn't seem relevant. – Gregor Thomas Sep 26 '19 at 16:17
  • Can also use this which is not very great since you will manually identify which is which from the "quartiles" `layer_data(my_plot)`. – NelsonGon Sep 26 '19 at 16:19
  • 3
    It would be helpful to add a [reproducible example of data](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – camille Sep 26 '19 at 16:53
  • @gregor I want the data that is visualized so excluding the outliers if I do summary(txdata2) it will contain the outliers. – Adam Sep 26 '19 at 17:10
  • 1
    Well, that's more complicated. You'll need to compute summary statistics to figure out what the outliers are, omit them, and then recompute summary statistics. Very unusual. – Gregor Thomas Sep 26 '19 at 20:11

0 Answers0