pointblank icon indicating copy to clipboard operation
pointblank copied to clipboard

Fail gracefully when calling info_columns when column doesn't exist

Open tylerlittlefield opened this issue 3 years ago • 2 comments

Prework

Proposal

It would be nice to have the active parameter in info_columns() so that it no longer fails when trying to document a missing column. Here is a small example that explains the problem, what the potential feature might look like, and what I am doing now in the mean time:

library(pointblank)

# this issue
small_table %>% 
  info_columns(
    column = "j",
    info = "foo bar"
  )

# potential feature, add agent semantics to informant
small_table %>% 
  info_columns(
    column = vars("j"),
    info = "foo bar",
    active = ~ . %>% has_columns(vars(j))
  )

# what i am doing now
small_table %>%
  tryCatch(
    expr = {
      info_columns(
        column = "j",
        info = "foo bar"
      )
    }, error = function(e) .
  )

tylerlittlefield avatar Jul 15 '21 15:07 tylerlittlefield

Thank you @tyluRp , this is a great proposal!

rich-iannone avatar Jul 15 '21 16:07 rich-iannone