如何在 ggplot2 中删除点和扩展箱线图

How to remove dots and extend boxplots in ggplot2

我有一些数据正在尝试构建一些箱线图,但出现此错误:

Warning message: Removed 1631 rows containing non-finite values (stat_boxplot).

没有 NA 个值,所有数据似乎都很好。我该如何解决这个问题,因为这些在我的数据中肯定是有价值的点,应该通过胡须进行扩展?

数据

数据相当大,我无法获得更小的子样本来产生误差,所以我只 post 原始数据。

dat.rds

ggplot2

dat <- readRDS("./dat.rds")
ggplot(dat, aes(x = factor(year), y = dev)) + geom_boxplot() + ylim(-40, 260)

编辑

我能够在 boxplot 中使用 `range = 6' 让它工作。有没有办法在 ggplot 中做到这一点?

boxplot(dev~year, data = d, range = 6)

删除ylim限制并使用geom_boxplotcoef参数,然后它工作正常:

library(ggplot2)
download.file(url = "https://www.dropbox.com/s/5mgogyclhim6hom/dat.rds?dl=1", tf <- tempfile(fileext = ".rds"))
dat <- readRDS(tf)
ggplot(dat, aes(x = factor(year), y = dev)) + 
  geom_boxplot(coef = 6)