Skip to content

Shift layers don't throw intuitive errors when trying to use distinct counts #78

Description

@mstackhouse

Prerequisites

For more information, see the CONTRIBUTING guide.

Description

Shift layer errors

Steps to Reproduce (Bug Report Only)

library(Tplyr)

tplyr_table(mtcars, carb) %>% 
  add_layer(
    group_shift(vars(column=vs, row=am)) %>% 
      set_distinct_by(cyl) %>% 
      set_format_strings(
        f_str('xx | xx | xx.x% || xx | xx | xx.x%', n, total, pct, distinct_n, distinct_total, distinct_pct)
      )
  ) %>% 
  build()
#> Error in `mutate()`:
#> ! Problem while computing `n = construct_shift_string(...)`.
#> ℹ The error occurred in group 1: carb = "1".
#> Caused by error in `if (nchar(x)[1] < left_pad) ...`:
#> ! missing value where TRUE/FALSE needed

Created on 2022-07-19 by the reprex package (v0.3.0)

Expected behavior: [What you expected to happen]

A graceful error indicating that distinct counts aren't supported for shift layers

Actual behavior: [What actually happened]

Error message from failing internals

Versions

This is using current devel branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions