diff --git a/DESCRIPTION b/DESCRIPTION index 3876a1af..2853d8f5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: tsibble Type: Package Title: Tidy Temporal Data Frames and Tools -Version: 0.1.2.9999 +Version: 0.1.3 Date: 2018-01-27 Authors@R: c( person("Earo", "Wang", email = "earo.wang@gmail.com", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index 0d14baf0..594c11d8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# tsibble 0.1.2.9999 +# tsibble 0.1.3 ## New functions diff --git a/R/tsummarise.R b/R/tsummarise.R index 49608217..fe99797c 100644 --- a/R/tsummarise.R +++ b/R/tsummarise.R @@ -158,7 +158,8 @@ tsum <- function(.data, first, remainder = NULL, FUN = summarise) { } if (is.null(remainder)) { # summarise_*() nonkey <- setdiff(flatten_key(key(.data)), flat_grps) - grped_data <- select(grped_data, - !! nonkey) + sel_cols <- setdiff(names(grped_data), nonkey) + grped_data <- select(grped_data, !! sel_cols) result <- FUN(grped_data) } else { # summarise() result <- FUN(grped_data, !!! remainder) diff --git a/README.Rmd b/README.Rmd index 3dc89cc7..f41ccef9 100644 --- a/README.Rmd +++ b/README.Rmd @@ -73,7 +73,7 @@ full_weather ### `tsummarise()` to summarise over calendar periods -`tsummarise()` and its scoped variants (including `_all()`, `_at()`, `_if()`) are introduced to aggregate interested variables over calendar periods. `tsummarise()` goes hand in hand with the index functions including `as.Date()`, `yearmonth()`, and `yearquarter()`, as well as other friends from *lubridate*, such as `year()` and `ceiling_date()`. For example, it would be of interest in computing average temperature and total precipitation per month, by applying `yearmonth()` to the hourly time index. +`tsummarise()` and its scoped variants (including `_all()`, `_at()`, `_if()`) are introduced to aggregate interested variables over calendar periods. `tsummarise()` goes hand in hand with the index functions including `as.Date()`, `yearmonth()`, and `yearquarter()`, as well as other friends from *lubridate*, such as `year()`, `ceiling_date()`, `floor_date()` and `round_date()`. For example, it would be of interest in computing average temperature and total precipitation per month, by applying `yearmonth()` to the hourly time index. ```{r tsummarise} full_weather %>% @@ -93,7 +93,7 @@ Temporal data often involves moving window calculations. Several functions in th * `slide()`: sliding window with overlapping observations. * `tile()`: tiling window without overlapping observations. -* `stretch()`: fixing an initial window and expanding more observations. +* `stretch()`: fixing an initial window and expanding to include more observations. For example, a moving average of window size 3 is carried out on hourly temperatures for each group (*origin*). diff --git a/README.md b/README.md index d95bf393..454add3d 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,10 @@ preserves time zones for date-times. `_if()`) are introduced to aggregate interested variables over calendar periods. `tsummarise()` goes hand in hand with the index functions including `as.Date()`, `yearmonth()`, and `yearquarter()`, as well as -other friends from *lubridate*, such as `year()` and `ceiling_date()`. -For example, it would be of interest in computing average temperature -and total precipitation per month, by applying `yearmonth()` to the -hourly time index. +other friends from *lubridate*, such as `year()`, `ceiling_date()`, +`floor_date()` and `round_date()`. For example, it would be of interest +in computing average temperature and total precipitation per month, by +applying `yearmonth()` to the hourly time index. ``` r full_weather %>% @@ -144,7 +144,7 @@ windows using purrr-like syntax: - `slide()`: sliding window with overlapping observations. - `tile()`: tiling window without overlapping observations. - - `stretch()`: fixing an initial window and expanding more + - `stretch()`: fixing an initial window and expanding to include more observations. For example, a moving average of window size 3 is carried out on hourly diff --git a/docs/articles/index.html b/docs/articles/index.html index 25b7012e..b1e13750 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -87,7 +87,7 @@
diff --git a/docs/index.html b/docs/index.html index 25eca2fa..b1a53563 100644 --- a/docs/index.html +++ b/docs/index.html @@ -123,7 +123,7 @@

fill_na() also handles filling NA by values or functions, and preserves time zones for date-times.

tsummarise() to summarise over calendar periods

-

tsummarise() and its scoped variants (including _all(), _at(), _if()) are introduced to aggregate interested variables over calendar periods. tsummarise() goes hand in hand with the index functions including as.Date(), yearmonth(), and yearquarter(), as well as other friends from lubridate, such as year() and ceiling_date(). For example, it would be of interest in computing average temperature and total precipitation per month, by applying yearmonth() to the hourly time index.

+

tsummarise() and its scoped variants (including _all(), _at(), _if()) are introduced to aggregate interested variables over calendar periods. tsummarise() goes hand in hand with the index functions including as.Date(), yearmonth(), and yearquarter(), as well as other friends from lubridate, such as year(), ceiling_date(), floor_date() and round_date(). For example, it would be of interest in computing average temperature and total precipitation per month, by applying yearmonth() to the hourly time index.

full_weather %>%
   group_by(origin) %>%
   tsummarise(
@@ -151,7 +151,7 @@
 
  • tile(): tiling window without overlapping observations.
  • -stretch(): fixing an initial window and expanding more observations.
  • +stretch(): fixing an initial window and expanding to include more observations.

    For example, a moving average of window size 3 is carried out on hourly temperatures for each group (origin).

    full_weather %>% 
    diff --git a/docs/news/index.html b/docs/news/index.html
    index 17825673..7cad09d2 100644
    --- a/docs/news/index.html
    +++ b/docs/news/index.html
    @@ -95,7 +95,7 @@ 

    Change log All releases

    -

    tsibble 0.1.2.9999

    +

    tsibble 0.1.3

    New functions

      @@ -180,7 +180,7 @@

      tsibble 0.0.1

      Contents

      index(monthly_ped)
      #> <quosure> #> expr: ^Year_Month -#> env: 0x7f9a040e3988
      +#> env: 0x7fb641d18358
      # Annual trips by Region and State ---- data(tourism) tourism %>%