dwww Home | Show directory contents | Find package

# distinct gives a warning when selecting an unknown column (#3140)

    Code
      df <- tibble(g = c(1, 2), x = c(1, 2))
      (expect_error(df %>% distinct(aa, x)))
    Output
      <error/rlang_error>
      Error in `distinct()`:
      ! Must use existing variables.
      x `aa` not found in `.data`.
    Code
      (expect_error(df %>% distinct(aa, bb)))
    Output
      <error/rlang_error>
      Error in `distinct()`:
      ! Must use existing variables.
      x `aa` not found in `.data`.
      x `bb` not found in `.data`.
    Code
      (expect_error(df %>% distinct(.data$aa)))
    Output
      <error/rlang_error>
      Error in `distinct()`:
      ! Must use existing variables.
      x `aa` not found in `.data`.
    Code
      (expect_error(df %>% distinct(y = a + 1)))
    Output
      <error/rlang_error>
      Error in `distinct()`:
      ! Problem adding computed columns.
      Caused by error in `mutate()`:
      ! Problem while computing `y = a + 1`.
      Caused by error in `mask$eval_all_mutate()`:
      ! object 'a' not found

Generated by dwww version 1.15 on Sat May 18 11:33:41 CEST 2024.