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

Forthcoming ggplot2 release and bayesAB #33

Closed
paleolimbot opened this issue May 9, 2019 · 1 comment
Closed

Forthcoming ggplot2 release and bayesAB #33

paleolimbot opened this issue May 9, 2019 · 1 comment

Comments

@paleolimbot
Copy link

We're in the process of preparing a ggplot2 release. As part of the release process, we run the R CMD check on packages that use ggplot2 to make sure we don't accidentally break code for downstream packages.

In running the R CMD check on bayesAB, we identified the following issue:

  • checking examples ... ERROR
    ...
    $Probability
    [1] 0.04541
    
    --------------------------------------------
    
    Credible Interval on (A - B) / B for interval length(s) (0.9) : 
    
    $Probability
              5%          95% 
    -0.355943366 -0.006198834 
    
    --------------------------------------------
    
    Posterior Expected Loss for choosing B over A:
    
    $Probability
    [1] 0.2601664
    
    > plot(AB1)
    Error: Either ymin or ymax must be given as an aesthetic.
    Execution halted
    

These failures are because bayesAB is using geom_ribbon() without layer data. The behaviour of layers when "setting" an aesthetic (outside aesI()) with length > 1 is not defined and may change in the future (in the case of geom_ribbon(), we now require that at least one of ymin or ymax is mapped to prevent bugs from occurring).

To fix this error, we suggest using a geom_*() function with its own data. Note that using .data$col_name within aes() is the preferred way to avoid CMD check issues about undefined variables when mapping columns (make sure you include #' importFrom rlang .data in at least one roxygen documentation block to avoid an error about the name .data being undefined).

ggplot2::ggplot() +
  ggplot2::geom_ribbon(
    ggplot2::aes(x = .data$x, ymax = .data$ymax),
    data = data.frame(x = 1:5, ymax = c(0, 1, 3, 1, 0)),
    ymin = 0
  )

Created on 2019-05-09 by the reprex package (v0.2.1)

We hope to release the new version of ggplot2 in the next two weeks, at which point you will get a note from CRAN that your package checks are failing. Let me know if I can help!

@FrankPortman
Copy link
Owner

Fixed by #34.

tidyverse/ggplot2#3303 (comment) in the spirit of this comment I'd like to be referred to in the future as "Torturer of APIs" 😄

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