@@ -18,10 +18,8 @@ ytd_fn <- function(x){
1818
1919 # create calendar table
2020
21- full_dbi <- create_calendar(x ) | >
22- dplyr :: mutate(
23- year = lubridate :: year(date )
24- )
21+ full_dbi <- create_full_dbi(x )
22+
2523
2624 # aggregate the data and create the cumulative sum
2725
@@ -58,11 +56,13 @@ pytd_fn <- function(x){
5856
5957
6058 # create calendar table
61- full_dbi <- create_calendar(x ) | >
62- dplyr :: mutate(
63- year = lubridate :: year(date )
64- ,.before = 1
65- )
59+ # full_dbi <- create_calendar(x) |>
60+ # dplyr::mutate(
61+ # year=lubridate::year(date)
62+ # ,.before = 1
63+ # )
64+
65+ full_dbi <- create_full_dbi(x )
6666
6767 # create lag table
6868
@@ -158,7 +158,9 @@ yoytd_fn <- function(x){
158158yoy_fn <- function (x ){
159159
160160 # create calendar
161- full_dbi <- create_calendar(x )
161+ # full_dbi <- create_calendar(x)
162+
163+ full_dbi <- create_full_dbi(x )
162164
163165 # create lag
164166 lag_dbi <- full_dbi | >
@@ -248,12 +250,14 @@ qtd_fn <- function(x){
248250
249251# x <- fpaR::qtd(.data,.date = order_date,.value = margin,calendar_type = "standard")
250252
251- full_dbi <- create_calendar(x ) | >
252- dplyr :: mutate(
253- year = lubridate :: year(date )
254- ,quarter = lubridate :: quarter(date )
255- ,.before = 1
256- )
253+ # full_dbi <- create_calendar(x) |>
254+ # dplyr::mutate(
255+ # year=lubridate::year(date)
256+ # ,quarter=lubridate::quarter(date)
257+ # ,.before = 1
258+ # )
259+
260+ full_dbi <- create_full_dbi(x )
257261
258262 out_dbi <- full_dbi | >
259263 dbplyr :: window_order(date ) | >
@@ -286,12 +290,14 @@ pqtd_fn <- function(x){
286290
287291 # create calendar table
288292
289- full_dbi <- create_calendar(x ) | >
290- dplyr :: mutate(
291- year = lubridate :: year(date )
292- ,quarter = lubridate :: quarter(date )
293- ,.before = 1
294- )
293+ # full_dbi <- create_calendar(x) |>
294+ # dplyr::mutate(
295+ # year=lubridate::year(date)
296+ # ,quarter=lubridate::quarter(date)
297+ # ,.before = 1
298+ # )
299+
300+ full_dbi <- create_full_dbi(x )
295301
296302 lag_dbi <- full_dbi | >
297303 dbplyr :: window_order(date ,quarter ,year ) | >
@@ -391,7 +397,9 @@ qtd_dbi <- qtd(.data=x@datum@data,.date=!!x@datum@date_quo,.value = !!x@value@va
391397qoq_fn <- function (x ){
392398
393399 # create calendar
394- full_dbi <- fpaR :: create_calendar(x )
400+ # full_dbi <- fpaR::create_calendar(x)
401+
402+ full_dbi <- create_full_dbi(x )
395403
396404 # create lag
397405 lag_dbi <- full_dbi | >
@@ -469,13 +477,15 @@ qtdopq_fn <- function(x){
469477# ' @keywords internal
470478mtd_fn <- function (x ){
471479
480+ #
481+ # full_dbi <- create_calendar(x) |>
482+ # dplyr::mutate(
483+ # year=lubridate::year(date)
484+ # ,month=lubridate::month(date)
485+ # ,.before = 1
486+ # )
472487
473- full_dbi <- create_calendar(x ) | >
474- dplyr :: mutate(
475- year = lubridate :: year(date )
476- ,month = lubridate :: month(date )
477- ,.before = 1
478- )
488+ full_dbi <- create_full_dbi(x )
479489
480490 out_dbi <- full_dbi | >
481491 dbplyr :: window_order(date ) | >
@@ -511,12 +521,16 @@ pmtd_fn <- function(x){
511521 lag_n_vec <- x @ fn @ lag_n | > rlang :: as_label()
512522 # create calendar table
513523
514- full_dbi <- create_calendar(x ) | >
515- dplyr :: mutate(
516- year = lubridate :: year(date )
517- ,month = lubridate :: month(date )
518- ,.before = 1
519- ) | >
524+ # full_dbi <- create_calendar(x) |>
525+ # dplyr::mutate(
526+ # year=lubridate::year(date)
527+ # ,month=lubridate::month(date)
528+ # ,.before = 1
529+ # ) |>
530+ # dplyr::select(-c(missing_date_indicator))
531+
532+
533+ full_dbi <- create_full_dbi(x ) | >
520534 dplyr :: select(- c(missing_date_indicator ))
521535
522536 # create lag table
@@ -613,7 +627,10 @@ momtd_fn <- function(x){
613627# ' @keywords internal
614628mom_fn <- function (x ){
615629
616- full_dbi <- create_calendar(x )
630+ # full_dbi <- create_calendar(x)
631+
632+ full_dbi <- create_full_dbi(x )
633+
617634
618635 # create lag
619636 lag_dbi <- full_dbi | >
@@ -708,13 +725,15 @@ mtdopm_fn <- function(x){
708725# ' @keywords internal
709726wtd_fn <- function (x ){
710727
711- full_dbi <- create_calendar(x ) | >
712- dplyr :: mutate(
713- year = lubridate :: year(date )
714- ,month = lubridate :: month(date )
715- ,week = dplyr :: sql(" DATE_PART('week',date)" )
716- ,.before = 1
717- )
728+ # full_dbi <- create_calendar(x) |>
729+ # dplyr::mutate(
730+ # year=lubridate::year(date)
731+ # ,month=lubridate::month(date)
732+ # ,week=dplyr::sql("DATE_PART('week',date)")
733+ # ,.before = 1
734+ # )
735+
736+ full_dbi <- create_full_dbi(x )
718737
719738
720739
@@ -751,15 +770,18 @@ pwtd_fn <- function(x){
751770
752771 # create calendar table
753772
754- full_dbi <- create_calendar(x ) | >
755- dplyr :: mutate(
756- year = lubridate :: year(date )
757- ,month = lubridate :: month(date )
758- ,week = dplyr :: sql(" DATE_PART('week',date)" )
759- ,.before = 1
760- )
773+ # full_dbi <- create_calendar(x) |>
774+ # dplyr::mutate(
775+ # year=lubridate::year(date)
776+ # ,month=lubridate::month(date)
777+ # ,week=dplyr::sql("DATE_PART('week',date)")
778+ # ,.before = 1
779+ # )
780+
761781
762782
783+ full_dbi <- create_full_dbi(x )
784+
763785 # create lag table
764786 lag_dbi <- full_dbi | >
765787 dbplyr :: window_order(date ) | >
@@ -849,7 +871,10 @@ wowtd_fn <- function(x){
849871wow_fn <- function (x ){
850872
851873
852- full_dbi <- create_calendar(x )
874+ # full_dbi <- create_calendar(x)
875+
876+
877+ full_dbi <- create_full_dbi(x )
853878
854879
855880 lag_dbi <- full_dbi | >
@@ -930,7 +955,10 @@ wtdopw_fn <- function(x){
930955# ' @keywords internal
931956atd_fn <- function (x ){
932957
933- full_dbi <- create_calendar(x )
958+ # full_dbi <- create_calendar(x)
959+
960+
961+ full_dbi <- create_full_dbi(x )
934962
935963 out_dbi <- full_dbi | >
936964 dbplyr :: window_order(date ) | >
@@ -958,7 +986,8 @@ atd_fn <- function(x){
958986# ' @keywords internal
959987dod_fn <- function (x ){
960988
961- full_dbi <- create_calendar(x )
989+ # full_dbi <- create_calendar(x)
990+ full_dbi <- create_full_dbi(x )
962991
963992 lag_dbi <- full_dbi | >
964993 dbplyr :: window_order(date ) | >
0 commit comments