Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to add a geom_smooth() to a qplot() with the following code:

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

However, the smoother is missing from the plot. I also receive the following warning message:

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

Does anybody know what is wrong here?

This is my setup:

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS
like image 778
Samuel Avatar asked Aug 11 '17 17:08

Samuel


People also ask

What is Stat_smooth in R?

stat_smooth() provides the following variables, some of which depend on the orientation: y or x. predicted value. ymin or xmin. lower pointwise confidence interval around the mean.

What does Geom_smooth () using formula YX mean?

The warning geom_smooth() using formula 'y ~ x' is not an error. Since you did not supply a formula for the fit, geom_smooth assumed y ~ x, which is just a linear relationship between x and y. You can avoid this warning by using geom_smooth(formula = y ~ x, method = "lm")

What is Geom smooth?

The geom smooth function is a function for the ggplot2 visualization package in R. Essentially, geom_smooth() adds a trend line over an existing plot.


1 Answers

I had similar issues:

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

and

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

when using geom_smooth(method="gam"). The problems vanished when I explicitly loaded the mgcv package version 1.8-17. I guess by default, ggplot (I use 2.2.1.9000) looked at 1.8-16, which was also in the search path. So you might want to update mgcv or make sure that the latest version is used.

like image 146
lukeA Avatar answered Sep 29 '22 16:09

lukeA