Graph with errobar using percentile function

Welcome! Your code should run with the correction suggested by @martin.R, but I’d suggest one other modification to make it clearer: it’s a good idea to use curly braces whenever you have a function definition that extends over more than one line. Like so:

Percentile <- function(perc) {
  # perc is the percentile which should be computed for the numeric vector x
  function(x) quantile(x, perc*1e-2, na.rm=TRUE)
}

Also, for future reference (because I hope you’ll ask more questions! :grin: ), here’s how to make code you post here appear with nice formatting :sparkles: (and not trigger other automatic formatting, like how your comment was turned into a section heading):