krumsieklab / maplet

R statistical toolbox for metabolomics
GNU General Public License v3.0
17 stars 6 forks source link

geom_smooth outputs unsupressed warning text (to stderr) about formula #113

Open KelseyChetnik opened 3 years ago

KelseyChetnik commented 3 years ago

In GitLab by @kelsey.chetnik on Jun 17, 2020, 12:08

KelseyChetnik commented 3 years ago

In GitLab by @krumsiek on Jul 10, 2020, 12:09

Not clear how to solve. Function seems to just print to stderr. suppressWarnings and suppressMessages do not solve the problem.

Code snipped to work on:

library(ggplot2)
data.frame(
  x=rnorm(20),
  y=rnorm(20)
) %>% ggplot(aes(x=x,y=y)) + geom_point() + suppressWarnings(geom_smooth( method = "lm", se=F, color = "black"))
KelseyChetnik commented 3 years ago

In GitLab by @krumsiek on Jul 19, 2020, 13:56

Update: Can we avoided by explicitly specifying the formula.

library(ggplot2)
data.frame(
  x=rnorm(20),
  y=rnorm(20)
) %>% ggplot(aes(x=x,y=y)) + geom_point() + geom_smooth(formula = y~x, method = "lm", se=F, color = "black")