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 vec_rbind() when using ggplot2 for very large dataframe #1923

Closed
paluigi opened this issue Apr 6, 2024 · 1 comment
Closed

Error in vec_rbind() when using ggplot2 for very large dataframe #1923

paluigi opened this issue Apr 6, 2024 · 1 comment

Comments

@paluigi
Copy link

paluigi commented Apr 6, 2024

Hello,
I am trying to use ggplot2 to create a facet_wrap plot for a dataframe with over 1 billion lines.
My code:

ggplot(data = enel_changes) +
  geom_boxplot(aes(x=freq, y=change)) +
  facet_wrap(vars(month), scales="free_y")

The error I get:

Error in `vec_rbind()`:
! Negative `n` in `compact_rep()`.
ℹ In file utils.c at line 897.
ℹ This is an internal error that was detected in the vctrs package.
  Please report it at <https://github.com/r-lib/vctrs/issues> with a reprex and the full backtrace.
Backtrace:
[90m     ▆
  1. ├─base (local) `<fn>`(x)
  2. ├─ggplot2:::print.ggplot(x)
  3. │ ├─ggplot2::ggplot_build(x)
  4. │ └─ggplot2:::ggplot_build.ggplot(x)
  5. │   └─layout$setup(data, plot$data, plot$plot_env)
  6. │     └─ggplot2 (local) setup(..., self = self)
  7. │       └─self$facet$compute_layout(data, self$facet_params)
  8. │         └─ggplot2 (local) compute_layout(..., self = self)
  9. │           └─ggplot2::combine_vars(data, params$plot_env, vars, drop = params$drop)
 10. │             ├─ggplot2:::unique0(vec_rbind0(!!!values[has_all]))
 11. │             └─ggplot2:::vec_rbind0(!!!values[has_all])
 12. │               ├─ggplot2:::with_ordered_restart(...)
 13. │               │ └─base::withCallingHandlers(...)
 14. │               └─vctrs::vec_rbind(..., .error_call = .error_call)
 15. └─rlang:::stop_internal_c_lib(...)
 16.   └─rlang::abort(message, call = call, .internal = TRUE, .frame = frame)

Possibly related to #1826 , the stack trace seems the same.
Please let me know what I can do to help debug.

@DavisVaughan
Copy link
Member

It's likely that ggplot2 has ended up attempting to create a data frame with >2 billion rows, hitting R's short vector limit. Unfortunately there isn't much we can do about this in the short term. Supporting long vectors in vctrs is a massive project that we don't plan to work on right now. Closing in favor of #1826 though.

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