roomba icon indicating copy to clipboard operation
roomba copied to clipboard

Doesn't work with mixed types

Open ldecicco-USGS opened this issue 7 years ago • 3 comments

can't bind rows

ldecicco-USGS avatar May 22 '18 00:05 ldecicco-USGS

y %>% dfs_idx(~ length(.x$goodstuff) > 0) %>%
  purrr:::map_dfr(~ y[[.x]])

# Error in bind_rows_(x, .id) : 
  # Column `goodstuff` can't be converted from character to integer

ivelasq avatar May 22 '18 17:05 ivelasq

example of issue with data:

toy_data <- jsonlite::fromJSON('
  {
                               "stuff": {
                               "buried": {
                               "deep": [
                               {
                               "goodstuff": "here",
                               "name": "Bob Rudis",
                               "secret_power": 5,
                               "other_secret_power": []
                               },
                               {
                               "goodstuff": "here",
                               "name": "Amanda Dobbyn",
                               "secret_power": 4,
                               "more_nested_stuff": 4
                               }
                               ],
                               "alsodeep": 2342423234,
                               "deeper": {
                               "foo": [
                               {
                               "goodstuff": 5,
                               "name": "barb",
                               "secret_power": []
                               },
                               {
                               "goodstuff": "here",
                               "name": "borris"
                               }
                               ]
                               }
                               }
                               }
                               }', simplifyVector = FALSE)

y <- toy_data %>% replace_null()

y %>% dfs_idx(~ length(.x$goodstuff) > 0) %>%
  purrr:::map_dfr(~ y[[.x]])

ivelasq avatar May 22 '18 22:05 ivelasq

I just checked with the new roomba() function - still get same error.

ivelasq avatar May 22 '18 22:05 ivelasq