rstudio / rstudio/pointblank

base pipe does not work inside `preconditions`

Open
#428 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Difficulty: [2] Intermediate Effort: [2] Medium Priority: [3] High Type: ☹︎ Bug
Dominant language
R
Stars
1k
Forks
59
Avg merge
25m
Merged PRs (30d)
4

Description

This works:

tbl <-
  dplyr::tibble(
    a = c(5, 7, 6, 5, 8, 7),
    b = c(7, 1, 0, 0, 8, 3),
    c = c(1, 1, 1, 3, 3, 3)
  )

tbl |> 
  create_agent() |> 
  rows_complete(
    columns = vars(a, b),
    preconditions = ~ . %>% dplyr::filter(a < 10),
    segments = b ~ c("group_1", "group_2"),
    actions = action_levels(warn_at = 0.1, stop_at = 0.2),
    label = "The `rows_complete()` step.",
    active = TRUE
  ) |> 
  interrogate()

This fails:

tbl |> 
  create_agent() |> 
  rows_complete(
    columns = vars(a, b),
    preconditions = ~ . |>  dplyr::filter(a < 10),
    segments = b ~ c("group_1", "group_2"),
    actions = action_levels(warn_at = 0.1, stop_at = 0.2),
    label = "The `rows_complete()` step.",
    active = TRUE
  ) |> 
  interrogate()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the implementation of rows_complete() and its preconditions handling, then compare how the %>% and |> examples are evaluated. Confirm the failing reproduction and investigate the pipe expression inside the precondition; done means the base-pipe example completes through interrogate() as the magrittr-pipe example does.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.