Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geom_textsmooth computation fails if method argument is not specified #79

Closed
tjebo opened this issue May 30, 2022 · 3 comments
Closed

Comments

@tjebo
Copy link

tjebo commented May 30, 2022

I came across this issue after I'd added a solution to this popular problem with your awesome package and a user asked me to demonstrate how one can do this with geom_smooth.

This seems very related to https://stackoverflow.com/questions/42493048/computation-failed-for-stat-summary-what-must-be-a-character-string-or-a-func and tidyverse/ggplot2#1937.
However, as you can see below, I am using reprex, and do have a completely empty session. I strongly assume there must be some objects defined that have names such as "mean" or "lm" that are not disambiguated any longer.

library(geomtextpath)
#> Loading required package: ggplot2

ggplot(iris, aes(Sepal.Length, Sepal.Width, label = "a")) +
  geom_textsmooth()
#> `geom_smooth()` using formula 'y ~ x'
#> Warning: Computation failed in `stat_smooth()`:
#> 'what' must be a function or character string

## works when specifying method argument
ggplot(iris, aes(Sepal.Length, Sepal.Width, label = "a")) +
  geom_textsmooth(method = "loess")
#> `geom_smooth()` using formula 'y ~ x'

Created on 2022-05-30 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       macOS Big Sur 10.16
#>  system   x86_64, darwin17.0
#>  ui       X11
#>  language (EN)
#>  collate  en_GB.UTF-8
#>  ctype    en_GB.UTF-8
#>  tz       Europe/London
#>  date     2022-05-30
#>  pandoc   2.14.0.3 @ /Applications/RStudio.app/Contents/MacOS/pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package      * version date (UTC) lib source

#>  geomtextpath * 0.1.0   2022-01-24 [1] CRAN (R 4.1.2)
#>  ggplot2      * 3.3.6   2022-05-03 [1] CRAN (R 4.1.2)

#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
@teunbrand
Copy link
Collaborator

Hi Tjebo,

Does this issue still occur with the dev version? We've seen a similar thing in #70 and fixed that issue.

Best

@tjebo
Copy link
Author

tjebo commented May 30, 2022

I will need to download the dev version first :) Will let you know in a couple of minutes.

@tjebo
Copy link
Author

tjebo commented May 30, 2022

Indeed, the issue is solved with the current dev version.

library(geomtextpath)
#> Loading required package: ggplot2

ggplot(iris, aes(Sepal.Length, Sepal.Width, label = "a")) +
  geom_textsmooth()
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Created on 2022-05-30 by the reprex package (v2.0.1)

sessioninfo::session_info()
#> ─ Session info 

#>  package      * version    date (UTC) lib source

#>  geomtextpath * 0.1.0.9000 2022-05-30 [1] Github (AllanCameron/geomtextpath@f11e256)
#>  ggplot2      * 3.3.6      2022-05-03 [1] CRAN (R 4.1.2)
──────────────────────────────────────────────────────────────────────────────

@tjebo tjebo closed this as completed May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants