I am trying to compute an empirical probability distribution for a continuous variable using the epdfPlot() function in the EnvStats:: package. I keep getting an error when I accept the default of discrete=FALSE.
Error in UseMethod("density") :
no applicable method for 'density' applied to an object of class "c('double', 'numeric')"
Reading through the documentation, I think this is somehow a result of how the function passes arguments to stats::density() because I don't have this problem when I set discrete = TRUE. As the documentation notes, the argument density.arg.list=NULL is ignored when discrete = TRUE. Here is the reproducible example:
library(EnvStats)
dat<-rnorm(500, 0, 1)
demo1<-epdfPlot(dat, discrete = FALSE, plot.it=FALSE) # throws error
demo2<-epdfPlot(dat, discrete = TRUE, plot.it=FALSE) # works
demo2
Is this possibly a bug?