Skip to content

Unable to use names_glue within pivot_wider() when NA is the only unique value #394

@camnesia

Description

@camnesia

Unable to use names_glue within pivot_wider() when the only unique value is NA - the same code does not cause any problems when lazy_dt() is not used.

example <- fish_encounters %>%
  mutate(test = NA_integer_) %>%
  lazy_dt() %>%
  pivot_wider(., 
              names_glue = "{test}",
              names_from = test, 
              values_from = seen,
              names_repair = 'minimal') %>%
  collect()

image

names_glue does work, if there are other values available in names (for example using the station variable). Using a variable with only NA does seem to be possible but only if names_glue is not used at all.

example <- fish_encounters %>%
  mutate(test = NA_integer_) %>%
  lazy_dt() %>%
  pivot_wider(., 
              names_glue = "{station}",
              names_from = station, 
              values_from = seen,
              names_repair = 'minimal') %>%
  collect()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions