Skip to content

combine fails to combine a list of characters with NA [with pull request: #2209] #2203

@zeehio

Description

@zeehio

Hi,

Thanks to everyone working on tibble, dplyr, tidyr... In general the tidyverse packages make a lot of people very happy to use R.

I have found a rather simple case where dplyr::combine fails, and the do.call rbind equivalent works as expected. I have tested this on the latest released dplyr and the current master (b205d1f) versions, both showing the same error. I found this error trying to unnest a data frame using tidyr, but my C++ skills and dplyr knowledge are not good enough to fix it.

library(dplyr)
do.call(rbind,list("a", "b", "c", NA, "e")) # Works

combine(list("a", "b", "c", NA, "e")) # Does not work
#Error in eval(substitute(expr), envir, enclos) : 
#  Can not automatically convert from character to logical. 

combine(list("a", "b", "c", NA_character_, "e")) # Workaround

This issue affects unnest in tidyr:

library(tibble)
library(tidyr)

aa <- tibble(ID = list("a", "b", "c", NA, "e"))
bb <- unnest_(aa, "ID") # I would expect bb == tibble(ID = c("a", "b", "c", NA, "e"))

Any help will be appreciated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions