r-lib / vctrs

Generic programming with typed R vectors

Home Page:https://vctrs.r-lib.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`vec_rbind()` + jsonlite + common class fallback issue

DavisVaughan opened this issue · comments

From tidyverse/dplyr#6896

vctrs::vec_rbind(
  tibble::tibble(msg = jsonlite::toJSON(list("a"), auto_unbox = TRUE)),
  tibble::tibble(msg = jsonlite::toJSON(list("b"), auto_unbox = TRUE))
)
#> Error in `vctrs::vec_rbind()`:
#> ! Can't convert `..1$msg` <json> to match type of `msg` <vctrs:::common_class_fallback>.
#> Backtrace:
#>      ▆
#>   1. ├─vctrs::vec_rbind(...)
#>   2. └─vctrs (local) `<fn>`()
#>   3.   └─vctrs::vec_default_cast(...)
#>   4.     ├─base::withRestarts(...)
#>   5.     │ └─base (local) withOneRestart(expr, restarts[[1L]])
#>   6.     │   └─base (local) doWithOneRestart(return(expr), restart)
#>   7.     └─vctrs::stop_incompatible_cast(...)
#>   8.       └─vctrs::stop_incompatible_type(...)
#>   9.         └─vctrs:::stop_incompatible(...)
#>  10.           └─vctrs:::stop_vctrs(...)
#>  11.             └─rlang::abort(message, class = c(class, "vctrs_error"), ..., call = call)

Created on 2023-11-06 with reprex v2.0.2