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

get_agent_x_list()$columns is empty for col_vals_expr() #477

Open
mayeulk opened this issue May 3, 2023 · 1 comment
Open

get_agent_x_list()$columns is empty for col_vals_expr() #477

mayeulk opened this issue May 3, 2023 · 1 comment

Comments

@mayeulk
Copy link
Contributor

mayeulk commented May 3, 2023

I notice that, for col_vals_expr(), the columns slot of the object returned by get_agent_x_list() is NA.
This is linked to #475, but as a slightly broader issue (such as "For failed rows, access columns used in validation, and only those").

In my code in issue #475, instead of
columns_to_display <- unique c((id_columns, get_agent_x_list(agent, i = c_step)$columns ))
I use the following workaround, with a hack involving all.vars(as.formula()):

c_agent_step <- get_agent_x_list(agent, i = c_rule)
if (c_agent_step$type == "col_vals_expr") {
   columns_to_display <- unique (c(id_columns,
                                   # get the variables from the expr-ession used in col_vals_expr()
                                   all.vars(as.formula( paste0("~", c_agent_step$values)))) )
 } else {
   columns_to_display <- unique (c(id_columns, c_agent_step$columns) )
 }

My use case here is a validation step involving:

  col_vals_expr(
    expr = expr( paste0("some_string", column1) == column2))

I would suggest adding something to fill in the columns slot in such cases (and maybe for specially(), too).

@rich-iannone
Copy link
Member

Thank you for raising this issue and digging into the details. This definitely should be fixed!

@rich-iannone rich-iannone added this to the v0.12.0 milestone Jul 21, 2023
@rich-iannone rich-iannone modified the milestones: v0.12.0, v0.13.0 Feb 20, 2024
@rich-iannone rich-iannone changed the title get_agent_x_list()$columns is empty for col_vals_expr() get_agent_x_list()$columns is empty for col_vals_expr() Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants