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

Error in min(c(x, xmin), na.rm = TRUE) : invalid 'type' (list) of argument #2610

Closed
karawoo opened this issue May 15, 2018 · 9 comments
Closed

Error in min(c(x, xmin), na.rm = TRUE) : invalid 'type' (list) of argument #2610

karawoo opened this issue May 15, 2018 · 9 comments
Assignees
Labels
Milestone

Comments

@karawoo
Copy link
Member

@karawoo karawoo commented May 15, 2018

#2584

Problem occurs in: FourCSeq, Rariant, RiboProfiling, Single.mTEC.Transcriptomes

From a quick look it seems that some interaction with ggbio might be the cause

@karawoo karawoo self-assigned this May 15, 2018
@hadley hadley added this to the v2.3.0 milestone May 15, 2018
@karawoo
Copy link
Member Author

@karawoo karawoo commented May 16, 2018

I believe this is coming up in ggbio's autoplot method. A reprex from ggbio docs, unfortunately not that minimal:

library("ggbio")
library("GenomicRanges")
set.seed(123)
gr.b <- GRanges(
  seqnames = "chr1",
  IRanges(
    start = seq(1, 100, by = 10),
    width = sample(4:9, size = 10, replace = TRUE)
  ),
  score = rnorm(10, 10, 3),
  value = runif(10, 1, 100)
)

p1 <- autoplot(gr.b, geom = "bar")
#> use score as y by default
#> Error in min(c(x, xmin), na.rm = TRUE): invalid 'type' (list) of argument

Created on 2018-05-15 by the reprex package (v0.2.0).

I think this is a tidyeval side effect, but I'm coming up against the limits of my ability to figure it out. I'm hoping I've narrowed it down enough that @hadley or @lionel- can point me in the right direction for the next step.

In the following line, ggbio looks up xmin values in the layer data: https://github.com/tengfei/ggbio/blob/fa214327b31bc0ecc9cfaf69e94a84d458c01e2c/R/utils.R#L138

With ggplot2 2.2.1, layer$mapping$xmin was a name, and this line got the relevant column of data out of the layer data data frame. In 2.2.1.9000 layer$mapping$xmin is a quosure, eval() doesn't have any effect as far as I can tell, and then finding the minimum value fails.

@hadley
Copy link
Member

@hadley hadley commented May 16, 2018

Yes, that's a tidy eval issue, so we can just describe in a bit more detail in the breaking changes. I'll do that tomorrow — thanks for the exploration!

@karawoo
Copy link
Member Author

@karawoo karawoo commented May 16, 2018

👍 we should make sure to notify ggbio even though revdepcheck doesn't flag it (I guess because it has no tests or examples). I'm pretty sure the rest of these packages are inheriting the problem from there.

@hadley
Copy link
Member

@hadley hadley commented May 16, 2018

@karawoo do you have time to finish this off today? It just needs a PR to docs mention this error under the tidy eval bullet. (No worries if not, I'll try and do later this afternoon).

@karawoo
Copy link
Member Author

@karawoo karawoo commented May 16, 2018

Yeah I can do it this evening

karawoo added a commit to karawoo/ggplot2 that referenced this issue May 17, 2018
@hadley hadley closed this in #2619 May 17, 2018
hadley added a commit that referenced this issue May 17, 2018
@maureenbug
Copy link

@maureenbug maureenbug commented Aug 2, 2018

Hi, I was wondering if this was fixed, because I'm still running into this issue (even with a fresh RStudio restart and re-installation of packages), and don't really see a work around.

Thanks!

PS I only ran into this problem once I had to restart RStudio to update some packages... seemed like the package update was the problem (which, based on what was said above makes sense)

@batpigandme
Copy link
Member

@batpigandme batpigandme commented Aug 3, 2018

The change is a breaking change in ggplot2, so in terms of an update with a “fix”, you should look to ggbio.

@maureenbug
Copy link

@maureenbug maureenbug commented Aug 3, 2018

Thanks!

@lock
Copy link

@lock lock bot commented Jan 30, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jan 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants