0

I was trying to change the whiskers (upper &lower limits) of boxplots and was directed to boxplotperc() in the StatDA package. The data I'm using has missing values and works fine when using the regular boxplot()

However when I used the function (i.e. boxplotperc(x)) I get the warning:

Error in quantile.default(x, quant) : 
  missing values and NaN's not allowed if 'na.rm' is FALSE`

I tried adding na.rm = TRUE to the function, but the same error is returned. As a new user of R, my understanding of the above error is that "missing values" should be allowed, but clearly that is not correct.

Is there any advice on how to make boxplotperc() work with missing data? Any help would be great. Thank you.

Ameno
  • 21
  • 6
  • 1
    It [doesn't appear as if `boxplotperc` has an `na.rm` option](http://www.inside-r.org/packages/cran/StatDA/docs/boxplotperc); maybe try `boxplotperc(na.omit(x))` – MichaelChirico Aug 16 '15 at 22:44
  • Thank you @MichaelChirico for the help while I'm learning. It worked perfectly! – Ameno Aug 16 '15 at 22:51
  • You can check `?boxplotperc` for a list of arguments. `R` is never consistent with what arguments accept `na.rm`, nor with what the `na.rm` option is called. you'll get used to it. – MichaelChirico Aug 16 '15 at 23:05
  • why not just do boxplotperc(x[!is.na(x)]) – nathanesau Aug 17 '15 at 01:47
  • Oddly enough,when I extracted the basic stats calculated using `boxplotperc()` (eg. median, percentiles, etc), it was a different number than if I did manually. Not sure why that happened. But the correct values are provided by `boxplot()', so I might stick with that. – Ameno Aug 17 '15 at 07:40

0 Answers0