Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snip_list(na_rm) argument #556

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yjunechoe
Copy link
Collaborator

This PR adds an option to snip_list() to control whether NA values are counted as an item in the list. This is implemented in pb_str_catalog() which receives na_rm passed down from snip_list().

# "high" coded as NA, ignored in report with `na_rm = TRUE`
small_table %>% 
  select(f) %>% 
  mutate(f = ifelse(f == "high", NA, f)) %>% 
  create_informant() %>% 
  info_columns(
    columns = f,
    `Items` = "This column contains {values_f}."
  ) %>%
  info_snippet(
    snippet_name = "values_f",
    fn = snip_list(column = "f", na_rm = TRUE)
  ) %>% 
  incorporate()
#> 
#> ── Incorporation Started - there is a single snippet to process ───
#> ✔ Information gathered.
#> ✔ Snippets processed.
#> ✔ Information built.
#> 
#> ── Incorporation Completed ────────────────────────────────────────

image

@yjunechoe yjunechoe linked an issue Aug 4, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Remove NAs from snip_list()
1 participant