Skip to content

Instantly share code, notes, and snippets.

@jtrecenti
Created February 16, 2024 00:50
Show Gist options
  • Save jtrecenti/01b823190c24508e29c1ea763ee0e0ee to your computer and use it in GitHub Desktop.
Save jtrecenti/01b823190c24508e29c1ea763ee0e0ee to your computer and use it in GitHub Desktop.
# reciclou mas deu um warning porque não é múltiplo
tibble::tibble(x = c('a', 'b', 'c')) |>
dplyr::filter(x == c('a', 'b'))
#> Warning: There was 1 warning in `dplyr::filter()`.
#> ℹ In argument: `x == c("a", "b")`.
#> Caused by warning in `x == c("a", "b")`:
#> ! comprimento do objeto maior não é múltiplo do comprimento do objeto menor
#> # A tibble: 2 × 1
#> x
#> <chr>
#> 1 a
#> 2 b
# reciclou e não conseguiu pegar o último valor
tibble::tibble(x = c('a', 'b', 'c', 'a')) |>
dplyr::filter(x == c('a', 'b'))
#> # A tibble: 2 × 1
#> x
#> <chr>
#> 1 a
#> 2 b
# reciclou e a comparação bateu no final, por sorte
tibble::tibble(x = c('a', 'b', 'c', 'b')) |>
dplyr::filter(x == c('a', 'b'))
#> # A tibble: 3 × 1
#> x
#> <chr>
#> 1 a
#> 2 b
#> 3 b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment