-
Notifications
You must be signed in to change notification settings - Fork 183
Closed
Description
library(dbplyr)
lazy_frame(x = 1) %>%
tidyr::pivot_longer(x, values_transform = list(value = as.character))
#> <SQL>
#> SELECT 'x' AS `name`, CAST(`x` AS TEXT) AS `value`
#> FROM `df`
lazy_frame(x = 1) %>%
tidyr::pivot_longer(x, values_transform = list(value = ~ as.character(.x)))
#> Error: Result 1 must be a single string, not NULL of length 0
spec1 <- tibble::tibble(.name = "x", .value = "val", key = "x")
lazy_frame(a = c(1, 1, 2), key = c("x", "x", "x"), val = c(1, 10, 100)) %>%
dbplyr:::dbplyr_pivot_wider_spec(spec1, values_fn = sum)
#> <SQL>
#> SELECT `a`, SUM(CASE WHEN (`key` = 'x') THEN (`val`) END) AS `x`
#> FROM `df`
#> GROUP BY `a`
lazy_frame(a = c(1, 1, 2), key = c("x", "x", "x"), val = c(1, 10, 100)) %>%
dbplyr:::dbplyr_pivot_wider_spec(spec1, values_fn = ~ sum(.x, na.rm = TRUE))
#> Error: Can't convert NULL to a stringCreated on 2022-01-05 by the reprex package (v2.0.1)
Metadata
Metadata
Assignees
Labels
No labels