Error in layer - "unused argument ( = median_hilow)"

#Hello, I am trying to run a graph command from tidyverse, ggplot(). I intend to
#summarize the y values for each unique x value. For that I have used commands
#from <>
#It keeps running on error!
ggplot(data = diamonds, mapping = aes(x = cut, y = depth))+
layer(geom = "pointrange", stat="summary", = median_hilow)
#"Error in layer(geom = "pointrange", stat = "summary", = median_hilow) :
#unused argument ( = median_hilow)"
#Can anyone help me please?

Are you looking for something like this? The Hmisc package must be installed for this to work. The default geom for stat_summary is pointrange.

DF <- data.frame(Grp <- rep(LETTERS[1:4], each = 20), Value = rnorm(80))
ggplot(DF, aes(x = Grp, y = Value)) + stat_summary( = median_hilow)

Created on 2020-06-04 by the reprex package (v0.3.0)

#Yes, it does pretty much what I have been looking for! Thank you. I also generated the
#same graph using geom_pointrange():
ggplot(data=diamonds, mapping = aes(x=cut, y=depth))+
#Although library(Hmisc) is not necessary in this case, I don't know if having installed
#the package as you suggested (and I did) played any role in the command above!

#Thank you again,


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.