tidyverts / tsibble

Tidy Temporal Data Frames and Tools
https://tsibble.tidyverts.org
GNU General Public License v3.0
528 stars 50 forks source link

Weird filtering error #260

Closed robjhyndman closed 2 years ago

robjhyndman commented 2 years ago

What's going on here?

library(tsibble)
tourism %>%
  filter(Region == "Adelaide")
#> Error: Can't proceed with the key of multiple variables.

Created on 2021-09-19 by the reprex package (v2.0.1)

mitchelloharawild commented 2 years ago

This is using stats::filter(). You want dplyr::filter().

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(tsibble)
#> 
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, union
tourism %>%
  filter(Region == "Adelaide")
#> # A tsibble: 320 x 5 [1Q]
#> # Key:       Region, State, Purpose [4]
#>    Quarter Region   State           Purpose  Trips
#>      <qtr> <chr>    <chr>           <chr>    <dbl>
#>  1 1998 Q1 Adelaide South Australia Business  135.
#>  2 1998 Q2 Adelaide South Australia Business  110.
#>  3 1998 Q3 Adelaide South Australia Business  166.
#>  4 1998 Q4 Adelaide South Australia Business  127.
#>  5 1999 Q1 Adelaide South Australia Business  137.
#>  6 1999 Q2 Adelaide South Australia Business  200.
#>  7 1999 Q3 Adelaide South Australia Business  169.
#>  8 1999 Q4 Adelaide South Australia Business  134.
#>  9 2000 Q1 Adelaide South Australia Business  154.
#> 10 2000 Q2 Adelaide South Australia Business  169.
#> # … with 310 more rows

Created on 2021-09-19 by the reprex package (v2.0.0)

robjhyndman commented 2 years ago

Of course. The filter clash bites me again. Thanks