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

Show used columns in col_vals_expr() #505

Merged
merged 21 commits into from
Jun 9, 2024

Conversation

yjunechoe
Copy link
Collaborator

@yjunechoe yjunechoe commented Nov 5, 2023

Summary

This PR aims to have col_vals_expr() show columns used in expr in the agent report. Example inspired by fn docs:

tbl <-
  dplyr::tibble(
    a = c(1, 2, 1, 7, 8, 6),
    b = c(0, 0, 0, 1, 1, 1),
    c = c(0.5, 0.3, 0.8, 1.4, 1.9, 1.2),
  )
c <- 1

tbl %>%
  create_agent() %>% 
  col_vals_expr(expr = ~ a %% 1 == 0) %>% 
  col_vals_expr(expr = ~ case_when(
    b == 0 ~ a %>% between(0, 5) & c < 1,
    b == 1 ~ a > 5 & c >= 1
  )) %>% 
  col_vals_expr(expr(.data$a + b == !!c)) %>% 
  col_vals_expr(expr = ~ a + d > 0) %>% 
  interrogate()

image

This is a draft because it needs more tests.

Related GitHub Issues and PRs

Checklist

@yjunechoe

This comment was marked as outdated.

@yjunechoe yjunechoe marked this pull request as ready for review June 9, 2024 09:44
@yjunechoe
Copy link
Collaborator Author

@rich-iannone I think I finally managed to get this working! The key was simply ensuring parse(..., keep.source = TRUE) - it's FALSE in non-interactive mode which was causing failures in GHA

@rich-iannone
Copy link
Member

This is amazing, thank you for figuring this out!

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 fbc7bb2 into rstudio:main Jun 9, 2024
12 of 13 checks passed
@yjunechoe yjunechoe deleted the columns-from-expr branch June 9, 2024 10:52
@yjunechoe yjunechoe linked an issue Jun 9, 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.

get_agent_x_list()$columns is empty for col_vals_expr()
2 participants