-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
bind_rows
Error: Internal error in vec_assign()
: value
should have been recycled to fit x
.
#5882
Comments
This comment has been minimized.
This comment has been minimized.
Another example: sensors <- list(list(id = "0526c0a4-0c15-490e-852b-e75c41dacb38", friendly_name = "Ambient air intake",
type = "temperature", instance = 1L, full_name = "unit_alpha.environment.1.temperature.1",
state = list(target_id = "0526c0a4-0c15-490e-852b-e75c41dacb38",
actual_state = 2L, scheduled_state = NULL, requested_state = NULL,
pending_state = NULL, comment = NULL, last_update = "2021-05-09T18:05:08.000Z")),
list(id = "05e6a5a0-960d-4adf-998a-67403044a0dd", friendly_name = "Exhaust air fan",
type = "air_flow", instance = 2L, full_name = "unit_alpha.environment.1.air_flow.2",
state = list(target_id = "05e6a5a0-960d-4adf-998a-67403044a0dd",
actual_state = 0L, scheduled_state = NULL, requested_state = NULL,
pending_state = NULL, comment = NULL, last_update = "2021-05-08T20:05:08.000Z")))
dplyr::bind_rows(sensors)
# > Error: Internal error in `vec_assign()`: `value` should have been recycled to fit `x`.
# > Run `rlang::last_error()` to see where the error occurred.
rlang::last_error()
# <error/rlang_error>
# Internal error in `vec_assign()`: `value` should have been recycled to fit `x`.
# Backtrace:
# 1. dplyr::bind_rows(...)
# 2. vctrs::vec_rbind(!!!dots, .names_to = .id)
# Run `rlang::last_trace()` to see the full context. As with #5749 this has NULLs in it due to being transformed from json (using |
A further note: prior to the mentioned #5749 changing the NULL's to NA's would allow Because of the insane circular dependency graph involving rlang/vctrs/dplyr/tibble and their dependents I can't get an "old" library installed to prove one way or the other, (even with upgrade_dependencies = F), as it is, I'm now stuck on the following: R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: BunsenLabs GNU/Linux 8.9 (Hydrogen)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] magrittr_2.0.1
loaded via a namespace (and not attached):
[1] fansi_0.4.2 crayon_1.4.1 utf8_1.2.1 dplyr_1.0.6
[5] R6_2.5.0 lifecycle_1.0.0 jsonlite_1.7.2 pillar_1.6.0
[9] rlang_0.4.11 remotes_2.3.0 vctrs_0.3.8 generics_0.1.0
[13] ellipsis_0.3.2 tools_4.0.4 glue_1.4.2 purrr_0.3.4
[17] compiler_4.0.4 pkgconfig_2.0.3 tcltk_4.0.4 tidyselect_1.1.1
[21] tibble_3.0.5 |
This seems to be under control now: library(dplyr, warn.conflicts = FALSE)
sensors <- list(list(id = "0526c0a4-0c15-490e-852b-e75c41dacb38", friendly_name = "Ambient air intake",
type = "temperature", instance = 1L, full_name = "unit_alpha.environment.1.temperature.1",
state = list(target_id = "0526c0a4-0c15-490e-852b-e75c41dacb38",
actual_state = 2L, scheduled_state = NULL, requested_state = NULL,
pending_state = NULL, comment = NULL, last_update = "2021-05-09T18:05:08.000Z")),
list(id = "05e6a5a0-960d-4adf-998a-67403044a0dd", friendly_name = "Exhaust air fan",
type = "air_flow", instance = 2L, full_name = "unit_alpha.environment.1.air_flow.2",
state = list(target_id = "05e6a5a0-960d-4adf-998a-67403044a0dd",
actual_state = 0L, scheduled_state = NULL, requested_state = NULL,
pending_state = NULL, comment = NULL, last_update = "2021-05-08T20:05:08.000Z")))
bind_rows(sensors)
#> # A tibble: 14 x 6
#> id friendly_name type instance full_name state
#> <chr> <chr> <chr> <int> <chr> <named>
#> 1 0526c0a4-0c15-4… Ambient air in… temper… 1 unit_alpha.environ… <chr […
#> 2 0526c0a4-0c15-4… Ambient air in… temper… 1 unit_alpha.environ… <int […
#> 3 0526c0a4-0c15-4… Ambient air in… temper… 1 unit_alpha.environ… <NULL>
#> 4 0526c0a4-0c15-4… Ambient air in… temper… 1 unit_alpha.environ… <NULL>
#> 5 0526c0a4-0c15-4… Ambient air in… temper… 1 unit_alpha.environ… <NULL>
#> 6 0526c0a4-0c15-4… Ambient air in… temper… 1 unit_alpha.environ… <NULL>
#> 7 0526c0a4-0c15-4… Ambient air in… temper… 1 unit_alpha.environ… <chr […
#> 8 05e6a5a0-960d-4… Exhaust air fan air_fl… 2 unit_alpha.environ… <chr […
#> 9 05e6a5a0-960d-4… Exhaust air fan air_fl… 2 unit_alpha.environ… <int […
#> 10 05e6a5a0-960d-4… Exhaust air fan air_fl… 2 unit_alpha.environ… <NULL>
#> 11 05e6a5a0-960d-4… Exhaust air fan air_fl… 2 unit_alpha.environ… <NULL>
#> 12 05e6a5a0-960d-4… Exhaust air fan air_fl… 2 unit_alpha.environ… <NULL>
#> 13 05e6a5a0-960d-4… Exhaust air fan air_fl… 2 unit_alpha.environ… <NULL>
#> 14 05e6a5a0-960d-4… Exhaust air fan air_fl… 2 unit_alpha.environ… <chr [… Created on 2021-05-17 by the reprex package (v2.0.0) Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.0.3 (2020-10-10)
#> os macOS Big Sur 10.16
#> system x86_64, darwin17.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/Paris
#> date 2021-05-17
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0)
#> backports 1.2.1 2020-12-09 [1] CRAN (R 4.0.2)
#> cli 2.5.0 2021-04-26 [1] CRAN (R 4.0.2)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.2)
#> DBI 1.1.1 2021-01-15 [1] CRAN (R 4.0.2)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.2)
#> dplyr * 1.0.6.9000 2021-05-17 [1] local
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.0.3)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.0)
#> fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.2)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2)
#> generics 0.1.0 2020-10-31 [1] CRAN (R 4.0.2)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.0.2)
#> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.0.2)
#> knitr 1.33 2021-04-24 [1] CRAN (R 4.0.2)
#> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.3)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.2)
#> pillar 1.6.0 2021-04-13 [1] CRAN (R 4.0.2)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.0)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.2)
#> reprex 2.0.0 2021-04-02 [1] CRAN (R 4.0.2)
#> rlang 0.4.11 2021-04-30 [1] CRAN (R 4.0.2)
#> rmarkdown 2.7 2021-02-19 [1] CRAN (R 4.0.2)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.2)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0)
#> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.2)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0)
#> styler 1.4.1 2021-03-30 [1] CRAN (R 4.0.2)
#> tibble 3.1.1 2021-04-18 [1] CRAN (R 4.0.2)
#> tidyselect 1.1.1 2021-04-30 [1] CRAN (R 4.0.2)
#> utf8 1.2.1 2021-03-12 [1] CRAN (R 4.0.2)
#> vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.0.2)
#> withr 2.4.2 2021-04-18 [1] CRAN (R 4.0.2)
#> xfun 0.22 2021-03-11 [1] CRAN (R 4.0.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.0)
#>
#> [1] /Users/romainfrancois/.R/library/4.0
#> [2] /Library/Frameworks/R.framework/Versions/4.0/Resources/library |
It certainly seems to be working a lot better than it has lately. But it's done something odd with the nested list: library(magrittr)
sensors <- list(list(id = "0526c0a4-0c15-490e-852b-e75c41dacb38", friendly_name = "Ambient air intake",
type = "temperature", instance = 1L, full_name = "unit_alpha.environment.1.temperature.1",
state = list(target_id = "0526c0a4-0c15-490e-852b-e75c41dacb38",
actual_state = 2L, scheduled_state = NULL, requested_state = NULL,
pending_state = NULL, comment = NULL, last_update = "2021-05-09T18:05:08.000Z")),
list(id = "05e6a5a0-960d-4adf-998a-67403044a0dd", friendly_name = "Exhaust air fan",
type = "air_flow", instance = 2L, full_name = "unit_alpha.environment.1.air_flow.2",
state = list(target_id = "05e6a5a0-960d-4adf-998a-67403044a0dd",
actual_state = 0L, scheduled_state = NULL, requested_state = NULL,
pending_state = NULL, comment = NULL, last_update = "2021-05-08T20:05:08.000Z")))
sensors %>% dplyr::bind_rows() %>% str()
#> tibble [14 × 6] (S3: tbl_df/tbl/data.frame)
#> $ id : chr [1:14] "0526c0a4-0c15-490e-852b-e75c41dacb38" "0526c0a4-0c15-490e-852b-e75c41dacb38" "0526c0a4-0c15-490e-852b-e75c41dacb38" "0526c0a4-0c15-490e-852b-e75c41dacb38" ...
#> $ friendly_name: chr [1:14] "Ambient air intake" "Ambient air intake" "Ambient air intake" "Ambient air intake" ...
#> $ type : chr [1:14] "temperature" "temperature" "temperature" "temperature" ...
#> $ instance : int [1:14] 1 1 1 1 1 1 1 2 2 2 ...
#> $ full_name : chr [1:14] "unit_alpha.environment.1.temperature.1" "unit_alpha.environment.1.temperature.1" "unit_alpha.environment.1.temperature.1" "unit_alpha.environment.1.temperature.1" ...
#> $ state :List of 14
#> ..$ target_id : chr "0526c0a4-0c15-490e-852b-e75c41dacb38"
#> ..$ actual_state : int 2
#> ..$ scheduled_state: NULL
#> ..$ requested_state: NULL
#> ..$ pending_state : NULL
#> ..$ comment : NULL
#> ..$ last_update : chr "2021-05-09T18:05:08.000Z"
#> ..$ target_id : chr "05e6a5a0-960d-4adf-998a-67403044a0dd"
#> ..$ actual_state : int 0
#> ..$ scheduled_state: NULL
#> ..$ requested_state: NULL
#> ..$ pending_state : NULL
#> ..$ comment : NULL
#> ..$ last_update : chr "2021-05-08T20:05:08.000Z" Created on 2021-05-18 by the reprex package (v2.0.0) Using tidyr::nest() get's it closer to how it used to be: sensors %>% dplyr::bind_rows() %>% tidyr::nest(state = c(state)) %>% str()
#> tibble [2 × 6] (S3: tbl_df/tbl/data.frame)
#> $ id : chr [1:2] "0526c0a4-0c15-490e-852b-e75c41dacb38" "05e6a5a0-960d-4adf-998a-67403044a0dd"
#> $ friendly_name: chr [1:2] "Ambient air intake" "Exhaust air fan"
#> $ type : chr [1:2] "temperature" "air_flow"
#> $ instance : int [1:2] 1 2
#> $ full_name : chr [1:2] "unit_alpha.environment.1.temperature.1" "unit_alpha.environment.1.air_flow.2"
#> $ state :List of 2
#> ..$ : tibble [7 × 1] (S3: tbl_df/tbl/data.frame)
#> .. ..$ state:List of 7
#> .. .. ..$ target_id : chr "0526c0a4-0c15-490e-852b-e75c41dacb38"
#> .. .. ..$ actual_state : int 2
#> .. .. ..$ scheduled_state: NULL
#> .. .. ..$ requested_state: NULL
#> .. .. ..$ pending_state : NULL
#> .. .. ..$ comment : NULL
#> .. .. ..$ last_update : chr "2021-05-09T18:05:08.000Z"
#> ..$ : tibble [7 × 1] (S3: tbl_df/tbl/data.frame)
#> .. ..$ state:List of 7
#> .. .. ..$ target_id : chr "05e6a5a0-960d-4adf-998a-67403044a0dd"
#> .. .. ..$ actual_state : int 0
#> .. .. ..$ scheduled_state: NULL
#> .. .. ..$ requested_state: NULL
#> .. .. ..$ pending_state : NULL
#> .. .. ..$ comment : NULL
#> .. .. ..$ last_update : chr "2021-05-08T20:05:08.000Z" |
When using
bind_rows
I'm getting:Error: Internal error in vec_assign(): value should have been recycled to fit x.
Reproducible example:
The text was updated successfully, but these errors were encountered: