You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run tidyr::pivot_longer() on a SQL table with no rows, the names_to column is of type logical, instead of character. This seems be inconsistent with what the pivot_longer documentation implies:
names_transform, values_transform
...
If not specified, the type of the columns generated from names_to will be character, and the type of the variables generated from values_to will be the common type of the input columns used to generate them.
Furthermore, setting names_transform = as.character doesn't change the result. It would be nice to have this to be more consistent with pivot_longer.data.frame().
Reprex
library(dbplyr)
memdb_frame(
id=character(),
x= integer(),
y= integer(),
) %>%
tidyr::pivot_longer(-id)
#> # Source: SQL [0 x 3]#> # Database: sqlite 3.46.0 [:memory:]#> # ℹ 3 variables: id <chr>, name <lgl>, value <int>
When I run
tidyr::pivot_longer()
on a SQL table with no rows, thenames_to
column is of typelogical
, instead ofcharacter
. This seems be inconsistent with what thepivot_longer
documentation implies:Furthermore, setting
names_transform = as.character
doesn't change the result. It would be nice to have this to be more consistent withpivot_longer.data.frame()
.Reprex
Session info
The text was updated successfully, but these errors were encountered: