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

Merged
merged 2 commits into from
Aug 6, 2024

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
Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rich-iannone rich-iannone merged commit 856a7f4 into rstudio:main Aug 6, 2024
12 checks passed
@yjunechoe yjunechoe deleted the remove-na-snip_list branch August 7, 2024 00:08
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()
2 participants