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

时间:2017-08-11 17:38:39

标签: r ggplot2 tidyverse

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

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

然而,情节中缺少更顺畅的。我还收到以下警告信息:

  

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

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

这是我的设置:

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

4 个答案:

答案 0 :(得分:5)

我有类似的问题:

# `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或确保使用最新版本。

答案 1 :(得分:2)

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

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

答案 2 :(得分:1)

我有同样的问题。试图明确加载mgcv,但这没有做任何事情。由于我最初依靠ggplot2来安装mgcv,我自己回去安装了mgcv,以便包含最新版本,然后重新安装ggplot2,问题就出现了远。这是在Ubuntu 16.04上,ggplot2 2_2.2.1和mgcv 1.8-23。

答案 3 :(得分:0)

我也有这个问题,几乎放弃了。但是,当我之前简单地重新安装mgcv和ggplot2之后,该脚本就像以前一样恢复工作。

相关问题