Closed mitchelloharawild closed 4 years ago
It should work now @GeorgeAthana
library(fabletools)
x <- fabletools:::agg_vec(c(NA, "a"), c(TRUE, FALSE))
x
#> <agg_vec[2]>
#> [1] <aggregated> a
x=="a"
#> [1] FALSE TRUE
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)
as_tsibble(cbind(mdeaths, fdeaths)) %>%
aggregate_key(key, value = sum(value)) %>%
filter(key == "mdeaths")
#> # A tsibble: 72 x 3 [1M]
#> # Key: key [1]
#> index key value
#> <mth> <chr> <dbl>
#> 1 1974 Jan mdeaths 2134
#> 2 1974 Feb mdeaths 1863
#> 3 1974 Mar mdeaths 1877
#> 4 1974 Apr mdeaths 1877
#> 5 1974 May mdeaths 1492
#> 6 1974 Jun mdeaths 1249
#> 7 1974 Jul mdeaths 1280
#> 8 1974 Aug mdeaths 1131
#> 9 1974 Sep mdeaths 1209
#> 10 1974 Oct mdeaths 1492
#> # … with 62 more rows
Created on 2020-08-08 by the reprex package (v0.3.0)
vec_match.agg_vec()
method also needs to be added:
library(fabletools)
x <- fabletools:::agg_vec(c(NA, "a", "b"), c(TRUE, FALSE, FALSE))
x
#> <agg_vec[3]>
#> [1] <aggregated> a b
x %in% c("a", "b")
#> [1] FALSE FALSE
x %in% fabletools:::agg_vec(c("?", "b"), c(TRUE, FALSE))
#> [1] FALSE FALSE
Created on 2020-08-08 by the reprex package (v0.3.0)
Closing as I don't know if %in%
can be supported. vec_in()
works fine.
Created on 2020-08-08 by the reprex package (v0.3.0)