Closed
Description
When there are NA's in the names_from
variable dbplyr
translates pivot_wider
inconsistently.
library(dplyr)
library(dbplyr)
library(tidyr)
### need to setup your own SQL Server connection
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
x <- tibble(
id = "id",
x = 1:3,
y = c("A", NA, "B")
)
copy_to(con, x, overwrite = T)
x2 <- tbl(con, "x")
# NA's work properly in-memory this returns 2
x %>%
pivot_wider(names_from = y, values_from = x) %>%
pull(`NA`)
# with dbplyr this returns NA
x2 %>%
pivot_wider(names_from = y, values_from = x) %>%
pull(`NA`)
Metadata
Metadata
Assignees
Labels
No labels