`stat_smooth()` 计算失败:找不到对象 'C_crspl'

Computation failed in `stat_smooth()`: object 'C_crspl' not found

我正在尝试使用以下代码将 geom_smooth() 添加到 qplot()

library(ggplot2)
library(ggplot2movies)
qplot(votes, rating, data = movies) + geom_smooth()

但是,绘图中缺少平滑器。我还收到以下警告消息:

Computation failed in stat_smooth(): object 'C_crspl' not found

有人知道这里出了什么问题吗?

这是我的设置:

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

我无法重现您的问题:它在我的系统中运行良好。我猜你对某些 ggplot2 依赖有问题。尝试重新启动会话并重新安装 ggplot2。

如果这不起作用,请使用不同的数据集和不同的方法测试 geom_smooth(),例如qplot(Sepal.Length, Sepal.Width, data = iris) + geom_smooth(method = 'lm')

我有类似的问题:

# `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
# Warning message:
# Computation failed in `stat_smooth()`:
# object 'C_crspl' not found 

# Warning message:
# Computation failed in `stat_smooth()`:
# object 'C_magic' not found  

使用 geom_smooth(method="gam") 时。当我显式加载 mgcv 包版本 1.8-17 时,问题就消失了。我想默认情况下,ggplot(我使用 2.2.1.9000)查看了 1.8-16,它也在搜索路径中。因此您可能想要更新 mgcv 或确保使用最新版本。

我遇到了完全相同的问题。尝试显式加载 mgcv,但这没有任何作用。由于我最初依赖 ggplot2 来安装 mgcv,所以我回去自己安装了 mgcv,以便包含最新版本,然后 re-installed ggplot2 和问题消失了。这是在 Ubuntu 16.04 上 ggplot2 2_2.2.1 和 mgcv 1.8-23.

我也有这个问题,差点放弃。但是,当我之前简单地重新安装 mgcv 并稍后重新安装 ggplot2 时,脚本只是恢复了以前的工作状态。