diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index 04064763..063e1a31 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index 7e6ea1cd..fab89ae1 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/ISSUE_TEMPLATE.html b/docs/ISSUE_TEMPLATE.html index 5a19c508..974df0b1 100644 --- a/docs/ISSUE_TEMPLATE.html +++ b/docs/ISSUE_TEMPLATE.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 5d4143b2..5626c2b4 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/SUPPORT.html b/docs/SUPPORT.html index 61f8069d..437d61ff 100644 --- a/docs/SUPPORT.html +++ b/docs/SUPPORT.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/articles/index.html b/docs/articles/index.html index e8a4eb67..51f3b27d 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/articles/intro-tsibble.html b/docs/articles/intro-tsibble.html index b96b20d6..0d37913a 100644 --- a/docs/articles/intro-tsibble.html +++ b/docs/articles/intro-tsibble.html @@ -38,7 +38,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -128,7 +128,7 @@

#> # A tsibble: 26,115 x 5 [1h]
 #> # Key:       origin [3]
 #>   origin time_hour            temp humid precip
-#> * <chr>  <dttm>              <dbl> <dbl>  <dbl>
+#>   <chr>  <dttm>              <dbl> <dbl>  <dbl>
 #> 1 EWR    2013-01-01 01:00:00  39.0  59.4      0
 #> 2 EWR    2013-01-01 02:00:00  39.0  61.6      0
 #> 3 EWR    2013-01-01 03:00:00  39.0  64.4      0
@@ -146,7 +146,7 @@ 

#> # A tsibble: 1,092 x 4 [1D]
 #> # Key:       origin [3]
 #>   origin date       temp_high temp_low
-#> * <chr>  <date>         <dbl>    <dbl>
+#>   <chr>  <date>         <dbl>    <dbl>
 #> 1 EWR    2013-01-01      41       28.0
 #> 2 EWR    2013-01-02      34.0     24.1
 #> 3 EWR    2013-01-03      34.0     26.1
@@ -162,7 +162,7 @@ 

#> # A tsibble: 23,408 x 5 [1Q]
 #> # Key:       Region | State, Purpose [308]
 #>   Quarter Region   State           Purpose  Trips
-#> *   <qtr> <chr>    <chr>           <chr>    <dbl>
+#>     <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.
@@ -177,7 +177,7 @@ 

#> # Key: Region | State [77] #> # Groups: Region [77] #> Region State Quarter Geo_Trips -#> * <chr> <chr> <qtr> <dbl> +#> <chr> <chr> <qtr> <dbl> #> 1 Adelaide South Australia 1998 Q1 659. #> 2 Adelaide South Australia 1998 Q2 450. #> 3 Adelaide South Australia 1998 Q3 593. @@ -206,7 +206,7 @@

#> # A tsibble: 336,776 x 21 [!]
 #> # Key:       flight_num [5,725]
 #>    year month   day dep_time sched_dep_time dep_delay arr_time
-#> * <int> <int> <int>    <int>          <int>     <dbl>    <int>
+#>   <int> <int> <int>    <int>          <int>     <dbl>    <int>
 #> 1  2013    11     3     1531           1540        -9     1653
 #> 2  2013    11     4     1539           1540        -1     1712
 #> 3  2013    11     5     1548           1540         8     1708
diff --git a/docs/articles/window.html b/docs/articles/window.html
index 9d18adee..768503a4 100644
--- a/docs/articles/window.html
+++ b/docs/articles/window.html
@@ -38,7 +38,7 @@
       
       
         tsibble
-        0.5.0.9000
+        0.5.1
       
     
 
@@ -122,7 +122,7 @@ 

Earo Wang

#> # A tsibble: 70,176 x 5 [1h] #> # Key: Sensor [4] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 @@ -142,7 +142,7 @@

#> # Key: Sensor [4] #> # Groups: Sensor [4] #> Sensor Date_Time Date Time Count Daily_MA -#> * <chr> <dttm> <date> <int> <int> <dbl> +#> <chr> <dttm> <date> <int> <int> <dbl> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 NA #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 NA #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 NA @@ -210,6 +210,7 @@

#> 2 Bourke Street Mall (North) <tsibble [1,032 × 4… <tibble [145,321 × 2… #> 3 QV Market-Elizabeth St (West) <tsibble [2,160 × 4… <tibble [334,825 × 2… #> 4 Southern Cross Station <tsibble [2,160 × 4… <tibble [334,825 × 2…

+

Why slide() not working for this case? It is intended to work with list (i.e. column-wise data frame). However, when we perform a row-wise sliding over data frame, pslide() does the job.

diff --git a/docs/authors.html b/docs/authors.html index 961fc7ab..9d3ceacb 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1

diff --git a/docs/index.html b/docs/index.html index 84d14f07..1d07bbfc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -125,7 +125,7 @@

The weather data included in the package nycflights13 is used as an example to illustrate. The “index” variable is the time_hour containing the date-times, and the “key” is the origin as weather stations created via id(). The key(s) together with the index uniquely identifies each observation, which gives a valid tsibble. Other columns can be considered as measured variables.

library(tsibble)
 weather <- nycflights13::weather %>% 
-  select(origin, time_hour, temp, humid, precip)
+  select(origin, time_hour, temp, humid, precip)
 weather_tsbl <- as_tsibble(weather, key = id(origin), index = time_hour)
 weather_tsbl
 #> # A tsibble: 26,115 x 5 [1h]
@@ -147,7 +147,7 @@ 

Often there are implicit missing cases in temporal data. If the observations are made at regular time interval, we could turn these implicit missings to be explicit simply using fill_na(). Meanwhile, fill NAs in by 0 for precipitation (precip). It is quite common to replaces NAs with its previous observation for each origin in time series analysis, which is easily done using fill() from tidyr.

full_weather <- weather_tsbl %>%
   fill_na(precip = 0) %>% 
-  group_by(origin) %>% 
+  group_by(origin) %>% 
   tidyr::fill(temp, humid, .direction = "down")
 full_weather
 #> # A tsibble: 26,190 x 5 [1h]
@@ -165,12 +165,12 @@ 

-index_by() + summarise() to aggregate over calendar periods

-

index_by() is the counterpart of group_by() in temporal context, but it groups the index only. In conjunction with index_by(), summarise() and its scoped variants aggregate interested variables over calendar periods. index_by() goes hand in hand with the index functions including as.Date(), yearweek(), yearmonth(), and yearquarter(), as well as other friends from lubridate. For example, it would be of interest in computing average temperature and total precipitation per month, by applying yearmonth() to the hourly time index.

+index_by() + summarise() to aggregate over calendar periods

+

index_by() is the counterpart of group_by() in temporal context, but it groups the index only. In conjunction with index_by(), summarise() and its scoped variants aggregate interested variables over calendar periods. index_by() goes hand in hand with the index functions including as.Date(), yearweek(), yearmonth(), and yearquarter(), as well as other friends from lubridate. For example, it would be of interest in computing average temperature and total precipitation per month, by applying yearmonth() to the hourly time index.

-

While collapsing rows (like summarise()), group_by() and index_by() will take care of updating the key and index respectively. This index_by() + summarise() combo can help with regularising a tsibble of irregular time space too.

+

While collapsing rows (like summarise()), group_by() and index_by() will take care of updating the key and index respectively. This index_by() + summarise() combo can help with regularising a tsibble of irregular time space too.

@@ -201,8 +201,8 @@

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

full_weather %>% 
-  group_by(origin) %>% 
-  mutate(temp_ma = slide_dbl(temp, ~ mean(., na.rm = TRUE), .size = 3))
+  group_by(origin) %>% 
+  mutate(temp_ma = slide_dbl(temp, ~ mean(., na.rm = TRUE), .size = 3))
 #> # A tsibble: 26,190 x 6 [1h]
 #> # Key:       origin [3]
 #> # Groups:    origin [3]
@@ -225,14 +225,14 @@ 

dplyr: diff --git a/docs/news/index.html b/docs/news/index.html index faa2d501..067c02ee 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1

@@ -135,25 +135,59 @@

Changelog

-
+

-tsibble 0.5.0.9000 Unreleased +tsibble 0.5.1 2018-08-20

+
+

+New features

+
    +
  • +tile() gained a new argument .bind = FALSE.
  • +
  • Vectorised arithmetic operators (+ & -) for yearweek, yearmonth, and yearquarter.
  • +
  • +new_interval() creates an “interval” object with the specified values.
  • +
+
+
+

+Improvements

+
    +
  • Faster performance in fill_na() for replacing values when group_by().
  • +
  • Speed improvement when subsetting yearweek, yearmonth and yearquarter using [.
  • +
+
+
+

+Bug fixes

  • Fixed key updating via group_by() + summarise(). (#47)
  • +
  • Respected the ordering of input variables while creating the key.
  • +
  • Fixed “attempt to select less than one element in integerOneIndex” error message in unnest.lst_ts().
  • +
  • Fixed incorrect interval when doing join operations for custom index class. (#52)
  • +
  • Avoided warnings when character input for key and value in gather.tbl_ts(). (#54)
  • +
+
+
+

+Misc

+ +

tsibble 0.5.0 2018-08-05

This release introduced the breaking changes to the “interval” class to make tsibble better support finer time resolution (e.g. millisecond, microsecond, and nanosecond). The “interval” format changes from upper case to short hand. To support new time index class, only index_valid() and pull_interval() need to be defined now.

-
+

-New features

+New features

  • Added “nanotime” support for nanoseconds.
  • Added scoped variant group_by_key() to easily group the key variables.
  • @@ -165,9 +199,9 @@

  • A new vignette on window functions.
-
+

-Improvements

+Improvements

  • Speed improvement for internals when it’s a known valid tsibble. (#43)
  • Better support “millisecond” and “microsecond”.
  • @@ -183,9 +217,9 @@

    time_unit() is a function instead of S3 generic, and made index extension a bit easier.

-
+

-Bug fixes

+Bug fixes

  • Fixed warning in format.yearweek().
  • Fixed group_by.lst_ts() for dropping the grouping information.
  • @@ -194,9 +228,9 @@

  • Fixed bug in .fill = NULL for slide().
-
+

-Misc

+Misc

  • Moved package “timeDate” from Imports to Suggests.
  • Added “anytime” to Imports for better parsing characters.
  • @@ -227,9 +261,9 @@

    pslider(), ptiler(), pstretcher() support multiple inputs now, and split them in parallel.

-
+

-New features

+New features
  • New holiday_aus() for Australian national and state-based public holiday.
  • Defined diff() for year-week, year-month, and year-quarter.
  • @@ -241,9 +275,9 @@

  • New S3 generics key_sum() for extending tsibble.
-
+

-Improvements

+Improvements
-
+

-Bug fixes

+Bug fixes
  • Fixed bug in as.ts.tbl_ts() for ignoring the value argument when the key is empty.
  • Fixed bug in [.tbl_ts() when subsetting columns by characters (#30).
  • @@ -269,9 +303,9 @@

  • If a column passed as index contains NA, abort.
-
+

-Misc

+Misc
  • Suggested on nycflights13 >= 1.0.0.
@@ -361,17 +395,17 @@

group_by.tbl_ts() behaves exactly the same as group_by.tbl_df now. Grouping variables are temporary for data manipulation. Nested or crossed variables are not the type that group_by() thinks.

-
+

-Improvements

+Improvements
  • Added overall time span to the glimpse.tbl_ts().
  • Slightly improved the speed of fill_na().
-
+

-Bug fixes

+Bug fixes
-
+

-Bug fixes

+Bug fixes
  • Fixed as_tsibble.ts() for daily time series (when frequency = 7).
  • @@ -461,9 +495,9 @@

  • Depends on purrr (>= 0.2.3)
-
+

-Bug fixes

+Bug fixes
  • Fixed the error message in glimpse.tbl_ts()
  • @@ -494,9 +528,9 @@

    inform_duplicates() informs which row has duplicated elements of key and index variables.

-
+

-Bug fixes

+Bug fixes
  • Fix bug in summarise.tbl_ts() and tsummarise.tbl_ts(), when calling functions with no parameters like dplyr::n().
  • In summarise.tbl_ts() and tsummarise.tbl_ts(), one grouping level should be dropped for the consistency with dplyr::summarise() for a grouped tbl_ts.
  • @@ -539,7 +573,7 @@

    Contents

    @@ -145,10 +145,11 @@

    Coerce to a tibble or data frame

# S3 method for tbl_ts
-as_tibble(x, ...)
+as_tibble(x, ..., rownames = NULL)
 
 # S3 method for tbl_ts
-as.data.frame(x, ...)
+as.data.frame(x, row.names = NULL, optional = FALSE, + ...)

Arguments

@@ -161,13 +162,35 @@

Arg

+ + + + + + + + + + + +
...

Ignored.

rownames

If NULL, remove row names (default for matrices, may become +default for data frames in the future). If NA, keep row names (current +default for data frames). Otherwise, the name of the new column that will +contain the existing row names.

row.names

NULL or a character vector giving the row + names for the data frame. Missing values are not allowed.

optional

logical. If TRUE, setting row names and + converting column names (to syntactic names: see + make.names) is optional. Note that all of R's + base package as.data.frame() methods use + optional only for column names treatment, basically with the + meaning of data.frame(*, check.names = !optional). + See also the make.names argument of the matrix method.

Examples

as_tibble(pedestrian)
#> # A tibble: 66,071 x 5 #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 @@ -184,7 +207,7 @@

Examp as_tibble(grped_ped)

#> # A tibble: 66,071 x 5 #> # Groups: Sensor [4] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 diff --git a/docs/reference/as-tsibble.html b/docs/reference/as-tsibble.html index 2e96918f..2b32df19 100644 --- a/docs/reference/as-tsibble.html +++ b/docs/reference/as-tsibble.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
@@ -151,7 +151,7 @@

Coerce to a tsibble object

validate = TRUE, ...) # S3 method for tbl_ts -as_tsibble(x, ...) +as_tsibble(x, validate = FALSE, ...) # S3 method for data.frame as_tsibble(x, key = id(), index, regular = TRUE, @@ -236,7 +236,7 @@

Examp ) as_tsibble(tbl1)

#> The `index` is `date`.
#> # A tsibble: 10 x 2 [1D] #> date value -#> * <date> <dbl> +#> <date> <dbl> #> 1 2017-01-01 -1.40 #> 2 2017-01-02 0.255 #> 3 2017-01-03 -2.44 @@ -249,7 +249,7 @@

Examp #> 10 2017-01-10 -0.283

# specify the index var as_tsibble(tbl1, index = date)
#> # A tsibble: 10 x 2 [1D] #> date value -#> * <date> <dbl> +#> <date> <dbl> #> 1 2017-01-01 -1.40 #> 2 2017-01-02 0.255 #> 3 2017-01-03 -2.44 @@ -270,7 +270,7 @@

Examp as_tsibble(tbl2, key = id(group))

#> The `index` is `mth`.
#> # A tsibble: 30 x 3 [1M] #> # Key: group [3] #> mth group value -#> * <mth> <chr> <dbl> +#> <mth> <chr> <dbl> #> 1 2017 Jan x -0.554 #> 2 2017 Feb x 0.629 #> 3 2017 Mar x 2.07 @@ -284,7 +284,7 @@

Examp #> # ... with 20 more rows

as_tsibble(tbl2, key = id(group), index = mth)
#> # A tsibble: 30 x 3 [1M] #> # Key: group [3] #> mth group value -#> * <mth> <chr> <dbl> +#> <mth> <chr> <dbl> #> 1 2017 Jan x -0.554 #> 2 2017 Feb x 0.629 #> 3 2017 Mar x 2.07 @@ -299,7 +299,7 @@

Examp # coerce ts to tsibble as_tsibble(AirPassengers)

#> # A tsibble: 144 x 2 [1M] #> index value -#> * <mth> <dbl> +#> <mth> <dbl> #> 1 1949 Jan 112 #> 2 1949 Feb 118 #> 3 1949 Mar 132 @@ -312,7 +312,7 @@

Examp #> 10 1949 Oct 119 #> # ... with 134 more rows

as_tsibble(sunspot.year)
#> # A tsibble: 289 x 2 [1Y] #> index value -#> * <dbl> <dbl> +#> <dbl> <dbl> #> 1 1700 5 #> 2 1701 11 #> 3 1702 16 @@ -325,7 +325,7 @@

Examp #> 10 1709 8 #> # ... with 279 more rows

as_tsibble(sunspot.month)
#> # A tsibble: 3,177 x 2 [1M] #> index value -#> * <mth> <dbl> +#> <mth> <dbl> #> 1 1749 Jan 58 #> 2 1749 Feb 62.6 #> 3 1749 Mar 70 @@ -338,7 +338,7 @@

Examp #> 10 1749 Oct 75.5 #> # ... with 3,167 more rows

as_tsibble(austres)
#> # A tsibble: 89 x 2 [1Q] #> index value -#> * <qtr> <dbl> +#> <qtr> <dbl> #> 1 1971 Q2 13067. #> 2 1971 Q3 13130. #> 3 1971 Q4 13198. @@ -355,7 +355,7 @@

Examp as_tsibble(z)

#> # A tsibble: 300 x 3 [1M] #> # Key: key [3] #> index key value -#> * <mth> <chr> <dbl> +#> <mth> <chr> <dbl> #> 1 1961 Jan Series 1 0.0700 #> 2 1961 Feb Series 1 -0.639 #> 3 1961 Mar Series 1 -0.0500 @@ -368,7 +368,7 @@

Examp #> 10 1961 Oct Series 1 -1.91 #> # ... with 290 more rows

as_tsibble(z, gather = FALSE)
#> # A tsibble: 100 x 4 [1M] #> index `Series 1` `Series 2` `Series 3` -#> * <mth> <dbl> <dbl> <dbl> +#> <mth> <dbl> <dbl> <dbl> #> 1 1961 Jan 0.0700 -0.163 -0.903 #> 2 1961 Feb -0.639 -0.827 1.32 #> 3 1961 Mar -0.0500 1.88 1.10 @@ -387,7 +387,7 @@

Examp as_tsibble(hts::htseg1)

#> # A tsibble: 50 x 4 [1Y] #> # Key: `Level 2` | `Level 1` [5] #> index value `Level 2` `Level 1` -#> * <dbl> <dbl> <chr> <chr> +#> <dbl> <dbl> <chr> <chr> #> 1 1992 7.86 AA A #> 2 1993 8.34 AA A #> 3 1994 8.55 AA A @@ -401,7 +401,7 @@

Examp #> # ... with 40 more rows

as_tsibble(hts::htseg2)
#> # A tsibble: 160 x 5 [1Y] #> # Key: `Level 3` | `Level 2` | `Level 1` [10] #> index value `Level 3` `Level 2` `Level 1` -#> * <dbl> <dbl> <chr> <chr> <chr> +#> <dbl> <dbl> <chr> <chr> <chr> #> 1 1992 -2.42 A10A A10 A #> 2 1993 -2.20 A10A A10 A #> 3 1994 -2.19 A10A A10 A diff --git a/docs/reference/as.ts.tbl_ts.html b/docs/reference/as.ts.tbl_ts.html index 9a151dbc..c1252918 100644 --- a/docs/reference/as.ts.tbl_ts.html +++ b/docs/reference/as.ts.tbl_ts.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
diff --git a/docs/reference/build_tsibble.html b/docs/reference/build_tsibble.html index a7712a27..6790c5a3 100644 --- a/docs/reference/build_tsibble.html +++ b/docs/reference/build_tsibble.html @@ -6,7 +6,7 @@ -Construct a tsibble object for extension — build_tsibble • tsibble +Low-level construction of a tsibble object — build_tsibble • tsibble @@ -36,7 +36,7 @@ - + tsibble - 0.5.0.9000 + 0.5.1
@@ -139,7 +139,7 @@
@@ -210,8 +210,8 @@

Arg interval -

NULL computes the interval. Use the specified interval as -is, if an class of interval is supplied.

+

NULL computes the interval. Use the specified interval via +new_interval() as is, if an class of interval is supplied.

@@ -225,7 +225,7 @@

Examp #> # Key: Sensor [4] #> # Groups: @ Date [731] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 diff --git a/docs/reference/case_na.html b/docs/reference/case_na.html index 75e049d3..3d16abc8 100644 --- a/docs/reference/case_na.html +++ b/docs/reference/case_na.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1

diff --git a/docs/reference/difference.html b/docs/reference/difference.html index 55e488fa..0d24cf29 100644 --- a/docs/reference/difference.html +++ b/docs/reference/difference.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
@@ -189,7 +189,7 @@

Examp scrambled <- tsbl %>% slice(sample(nrow(tsbl)))

#> Warning: The `tbl_ts` is not sorted by `year`.
wrong <- mutate(scrambled, diff = difference(value))
#> Warning: The `tbl_ts` is not sorted by `year`.
arrange(wrong, year)
#> # A tsibble: 6 x 3 [1Y] #> year value diff -#> * <int> <dbl> <dbl> +#> <int> <dbl> <dbl> #> 1 2000 0 -4 #> 2 2001 1 -24 #> 3 2002 4 -12 @@ -198,7 +198,7 @@

Examp #> 6 2005 25 NA

right <- mutate(scrambled, diff = difference(value, order_by = year))
#> Warning: The `tbl_ts` is not sorted by `year`.
arrange(right, year)
#> # A tsibble: 6 x 3 [1Y] #> year value diff -#> * <int> <dbl> <dbl> +#> <int> <dbl> <dbl> #> 1 2000 0 NA #> 2 2001 1 1 #> 3 2002 4 3 diff --git a/docs/reference/fill-na.html b/docs/reference/fill-na.html index 6e0df897..5727e1bf 100644 --- a/docs/reference/fill-na.html +++ b/docs/reference/fill-na.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
@@ -160,8 +160,7 @@

Arg ...

A set of name-value pairs. The values will replace existing explicit missing values by variable, otherwise NA. The replacement values must be of -the same type as the original one. If using a function to fill the NA, -please make sure that na.rm = TRUE is switched on.

+the same type as the original one.

.full @@ -187,7 +186,7 @@

Examp fill_na(harvest, .full = TRUE)

#> # A tsibble: 10 x 3 [1Y] #> # Key: fruit [2] #> year fruit kilo -#> * <dbl> <chr> <int> +#> <dbl> <chr> <int> #> 1 2010 cherry NA #> 2 2011 cherry 3 #> 3 2012 cherry 2 @@ -201,7 +200,7 @@

Examp full_harvest

#> # A tsibble: 8 x 3 [1Y] #> # Key: fruit [2] #> year fruit kilo -#> * <dbl> <chr> <int> +#> <dbl> <chr> <int> #> 1 2011 cherry 3 #> 2 2012 cherry 2 #> 3 2013 cherry NA @@ -217,7 +216,7 @@

Examp #> # Key: fruit [2] #> # Groups: fruit [2] #> year fruit kilo -#> * <dbl> <chr> <int> +#> <dbl> <chr> <int> #> 1 2011 cherry 3 #> 2 2012 cherry 2 #> 3 2013 cherry 2 @@ -231,7 +230,7 @@

Examp fill_na(kilo = 0L)

#> # A tsibble: 8 x 3 [1Y] #> # Key: fruit [2] #> year fruit kilo -#> * <dbl> <chr> <int> +#> <dbl> <chr> <int> #> 1 2011 cherry 3 #> 2 2012 cherry 2 #> 3 2013 cherry 0 @@ -241,12 +240,11 @@

Examp #> 7 2012 kiwi 0 #> 8 2013 kiwi 8

# replace NA using a function by variable ---- -# enable `na.rm = TRUE` when necessary ---- harvest %>% - fill_na(kilo = sum(kilo, na.rm = TRUE))
#> # A tsibble: 8 x 3 [1Y] + fill_na(kilo = sum(kilo))
#> # A tsibble: 8 x 3 [1Y] #> # Key: fruit [2] #> year fruit kilo -#> * <dbl> <chr> <int> +#> <dbl> <chr> <int> #> 1 2011 cherry 3 #> 2 2012 cherry 2 #> 3 2013 cherry 31 @@ -258,11 +256,11 @@

Examp # replace NA using a function for each group ---- harvest %>% group_by(fruit) %>% - fill_na(kilo = sum(kilo, na.rm = TRUE))

#> # A tsibble: 8 x 3 [1Y] + fill_na(kilo = sum(kilo))
#> # A tsibble: 8 x 3 [1Y] #> # Key: fruit [2] #> # Groups: fruit [2] #> year fruit kilo -#> * <dbl> <chr> <int> +#> <dbl> <chr> <int> #> 1 2011 cherry 3 #> 2 2012 cherry 2 #> 3 2013 cherry 14 @@ -274,15 +272,11 @@

Examp # replace NA ---- pedestrian %>% group_by(Sensor) %>% - fill_na( - Date = lubridate::as_date(Date_Time), - Time = lubridate::hour(Date_Time), - Count = as.integer(median(Count, na.rm = TRUE)) - )

#> # A tsibble: 69,048 x 5 [1h] + fill_na(Count = as.integer(median(Count)))
#> Warning: number of items to replace is not a multiple of replacement length
#> # A tsibble: 69,048 x 5 [1h] #> # Key: Sensor [4] #> # Groups: Sensor [4] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 diff --git a/docs/reference/find_duplicates.html b/docs/reference/find_duplicates.html index f03922fb..bde3668f 100644 --- a/docs/reference/find_duplicates.html +++ b/docs/reference/find_duplicates.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
diff --git a/docs/reference/gaps.html b/docs/reference/gaps.html index 02b3f1c7..9f818238 100644 --- a/docs/reference/gaps.html +++ b/docs/reference/gaps.html @@ -80,7 +80,7 @@ tsibble - 0.5.0.9000 + 0.5.1
diff --git a/docs/reference/group_by_key.html b/docs/reference/group_by_key.html index dbbc28b9..bfbf1940 100644 --- a/docs/reference/group_by_key.html +++ b/docs/reference/group_by_key.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
@@ -178,7 +178,7 @@

Examp #> # Key: Region | State, Purpose [308] #> # Groups: Region, State, Purpose [308] #> Quarter Region State Purpose Trips -#> * <qtr> <chr> <chr> <chr> <dbl> +#> <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. diff --git a/docs/reference/guess_frequency.html b/docs/reference/guess_frequency.html index fe3adaba..26114e6e 100644 --- a/docs/reference/guess_frequency.html +++ b/docs/reference/guess_frequency.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1

diff --git a/docs/reference/holiday_aus.html b/docs/reference/holiday_aus.html index f4e6b954..5d9fe4ca 100644 --- a/docs/reference/holiday_aus.html +++ b/docs/reference/holiday_aus.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
@@ -170,9 +170,9 @@

Details

Not documented public holidays:

  • AFL public holidays for Victoria

  • Queen's Birthday for Western Australia

  • -
  • Royal Queensland Show for Queensland, which is for Brisbane only -This function requires "timeDate" to be installed.

  • +
  • Royal Queensland Show for Queensland, which is for Brisbane only

+

This function requires "timeDate" to be installed.

References

diff --git a/docs/reference/id.html b/docs/reference/id.html index 3950e5cb..64a0050f 100644 --- a/docs/reference/id.html +++ b/docs/reference/id.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
diff --git a/docs/reference/index-by.html b/docs/reference/index-by.html index 31f20404..9c9a14e4 100644 --- a/docs/reference/index-by.html +++ b/docs/reference/index-by.html @@ -84,7 +84,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -202,7 +202,7 @@

Examp monthly_ped
#> # A tsibble: 95 x 4 [1M] #> # Key: Sensor [4] #> Sensor Year_Month Max_Count Min_Count -#> * <chr> <mth> <dbl> <dbl> +#> <chr> <mth> <dbl> <dbl> #> 1 Birrarung Marr 2015 Jan 5524 1 #> 2 Birrarung Marr 2015 Feb 10121 1 #> 3 Birrarung Marr 2015 Mar 9858 1 @@ -224,7 +224,7 @@

Examp )

#> # A tsibble: 2,755 x 4 [1D] #> # Key: Sensor [4] #> Sensor Date Max_Count Min_Count -#> * <chr> <date> <dbl> <dbl> +#> <chr> <date> <dbl> <dbl> #> 1 Birrarung Marr 2015-01-01 1630 44 #> 2 Birrarung Marr 2015-01-02 352 1 #> 3 Birrarung Marr 2015-01-03 226 3 @@ -244,7 +244,7 @@

Examp #> # Key: Region | State [77] #> # Groups: Region [77] #> Region State Year Total -#> * <chr> <chr> <dbl> <dbl> +#> <chr> <chr> <dbl> <dbl> #> 1 Adelaide South Australia 1998 2226. #> 2 Adelaide South Australia 1999 2218. #> 3 Adelaide South Australia 2000 2418. diff --git a/docs/reference/index-rd.html b/docs/reference/index-rd.html index a432d05d..402ba84f 100644 --- a/docs/reference/index-rd.html +++ b/docs/reference/index-rd.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1

diff --git a/docs/reference/index.html b/docs/reference/index.html index fa7da4e2..d50b7830 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -77,7 +77,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -160,7 +160,7 @@

Create/coerce to a tsibble

-

tsibble() creates a tbl_ts; as_tsibble() coerces other objects to tbl_ts; build_tsibble() constructs a tbl_ts with more controls over attributes.

+

tsibble() creates a tbl_ts; as_tsibble() coerces other objects to tbl_ts; build_tsibble() is the powerhouse of as_tsibble().

@@ -186,7 +186,7 @@

build_tsibble() build_tsibble_meta()

-

Construct a tsibble object for extension

+

Low-level construction of a tsibble object

@@ -405,6 +405,12 @@

new_interval()

+ +

Create a time interval

+ +

is_regular() is.regular() is_ordered()

@@ -487,7 +493,7 @@

left_join(<tbl_ts>) right_join(<tbl_ts>) inner_join(<tbl_ts>) full_join(<tbl_ts>) semi_join(<tbl_ts>) anti_join(<tbl_ts>) arrange(<tbl_ts>) arrange(<grouped_ts>) filter(<tbl_ts>) slice(<tbl_ts>) select(<tbl_ts>) rename(<tbl_ts>) mutate(<tbl_ts>) transmute(<tbl_ts>) summarise(<tbl_ts>) summarize(<tbl_ts>) group_by(<tbl_ts>) ungroup(<grouped_ts>) gather(<tbl_ts>) spread(<tbl_ts>) nest(<tbl_ts>) unnest(<lst_ts>)

+

arrange(<tbl_ts>) arrange(<grouped_ts>) filter(<tbl_ts>) slice(<tbl_ts>) select(<tbl_ts>) rename(<tbl_ts>) mutate(<tbl_ts>) transmute(<tbl_ts>) summarise(<tbl_ts>) summarize(<tbl_ts>) group_by(<tbl_ts>) ungroup(<grouped_ts>) left_join(<tbl_ts>) right_join(<tbl_ts>) inner_join(<tbl_ts>) full_join(<tbl_ts>) semi_join(<tbl_ts>) anti_join(<tbl_ts>) gather(<tbl_ts>) spread(<tbl_ts>) nest(<tbl_ts>) unnest(<lst_ts>)

Tidyverse methods for tsibble

diff --git a/docs/reference/index_valid.html b/docs/reference/index_valid.html index 989c5f6f..a89d948e 100644 --- a/docs/reference/index_valid.html +++ b/docs/reference/index_valid.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/reference/is-tsibble.html b/docs/reference/is-tsibble.html index 59ae382a..2ced5de1 100644 --- a/docs/reference/is-tsibble.html +++ b/docs/reference/is-tsibble.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/reference/key-size.html b/docs/reference/key-size.html index b9e77681..ee6ab119 100644 --- a/docs/reference/key-size.html +++ b/docs/reference/key-size.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/reference/key.html b/docs/reference/key.html index b3f7c382..bd13f812 100644 --- a/docs/reference/key.html +++ b/docs/reference/key.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -169,7 +169,7 @@

Examp filter(Sensor == "Southern Cross Station") unkey(sx)
#> # A tsibble: 17,539 x 5 [1h] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Southern Cross Station 2015-01-01 00:00:00 2015-01-01 0 746 #> 2 Southern Cross Station 2015-01-01 01:00:00 2015-01-01 1 312 #> 3 Southern Cross Station 2015-01-01 02:00:00 2015-01-01 2 180 diff --git a/docs/reference/key_sum.html b/docs/reference/key_sum.html index cc25ffc3..faec9e2f 100644 --- a/docs/reference/key_sum.html +++ b/docs/reference/key_sum.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
diff --git a/docs/reference/key_update.html b/docs/reference/key_update.html index e944f9b5..bdb76740 100644 --- a/docs/reference/key_update.html +++ b/docs/reference/key_update.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -177,7 +177,7 @@

Examp key_update(Region, Purpose)
#> # A tsibble: 23,408 x 5 [1Q] #> # Key: Region, Purpose [308] #> Quarter Region State Purpose Trips -#> * <qtr> <chr> <chr> <chr> <dbl> +#> <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. diff --git a/docs/reference/measured-vars.html b/docs/reference/measured-vars.html index 6c9f2f40..4ba6b5ae 100644 --- a/docs/reference/measured-vars.html +++ b/docs/reference/measured-vars.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
diff --git a/docs/reference/new_interval.html b/docs/reference/new_interval.html new file mode 100644 index 00000000..5f77d759 --- /dev/null +++ b/docs/reference/new_interval.html @@ -0,0 +1,214 @@ + + + + + + + + +Create a time interval — new_interval • tsibble + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

new_interval() creates an interval object with the specified values.

+ +
+ +
new_interval(...)
+ +

Arguments

+ + + + + + +
...

A list of time units to be included in the interval and their +amounts. "year", "quarter", "month", "week", "day", "hour", "minute", "second", +"millisecond", "microsecond", "nanosecond", "unit" are supported.

+ +

Value

+ +

an "interval" class

+ + +

Examples

+
new_interval(hour = 1, minute = 30)
#> 1h 30m
+
+ +
+ + +
+ + + + + + + + + diff --git a/docs/reference/pedestrian.html b/docs/reference/pedestrian.html index d76f559b..d516ae3e 100644 --- a/docs/reference/pedestrian.html +++ b/docs/reference/pedestrian.html @@ -80,7 +80,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -169,7 +169,7 @@

Examp pedestrian %>% fill_na()
#> # A tsibble: 69,048 x 5 [1h] #> # Key: Sensor [4] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 @@ -187,7 +187,7 @@

Examp summarise(MaxC = max(Count))

#> # A tsibble: 2,755 x 3 [1D] #> # Key: Sensor [4] #> Sensor Date MaxC -#> * <chr> <date> <dbl> +#> <chr> <date> <dbl> #> 1 Birrarung Marr 2015-01-01 1630 #> 2 Birrarung Marr 2015-01-02 352 #> 3 Birrarung Marr 2015-01-03 226 diff --git a/docs/reference/period.html b/docs/reference/period.html index 3abfc836..d6fa4d75 100644 --- a/docs/reference/period.html +++ b/docs/reference/period.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
diff --git a/docs/reference/pull-interval.html b/docs/reference/pull-interval.html index 8bd78cba..aa734ca3 100644 --- a/docs/reference/pull-interval.html +++ b/docs/reference/pull-interval.html @@ -80,7 +80,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html index 5e2fab89..8fe5c135 100644 --- a/docs/reference/reexports.html +++ b/docs/reference/reexports.html @@ -89,7 +89,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/reference/regular.html b/docs/reference/regular.html index 3d14fa06..88dbf8c8 100644 --- a/docs/reference/regular.html +++ b/docs/reference/regular.html @@ -82,7 +82,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/reference/slide.html b/docs/reference/slide.html index b262f483..3a8251fb 100644 --- a/docs/reference/slide.html +++ b/docs/reference/slide.html @@ -84,7 +84,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -216,7 +216,7 @@

Arg .bind

If .x is a list, should .x be combined before applying .f? -If .x is a list of data frame, row binding is carried out.

+If .x is a list of data frames, row binding is carried out.

.id @@ -231,6 +231,8 @@

Details the purrr-like syntax. For some specialist functions like mean and sum, you may like to check out for RcppRoll for faster performance.

+

slide() is intended to work with list (and column-wise data frame). To +perform row-wise sliding window on data frame, please check out pslide().

See also

diff --git a/docs/reference/slide2.html b/docs/reference/slide2.html index 43c2e097..896db955 100644 --- a/docs/reference/slide2.html +++ b/docs/reference/slide2.html @@ -84,7 +84,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -225,7 +225,7 @@

Arg .bind

If .x is a list, should .x be combined before applying .f? -If .x is a list of data frame, row binding is carried out.

+If .x is a list of data frames, row binding is carried out.

.id @@ -337,7 +337,44 @@

Examp #> [[3]]$z #> [1] 11 12 13 14 15 #> -#>
## window over 2 months +#>
+### +# row-wise sliding over data frame +### + +my_df <- data.frame( + group = rep(letters[1:2], each = 8), + x = c(1:8, 8:1), + y = 2 * c(1:8, 8:1) + rnorm(16), + date = rep(as.Date("2016-06-01") + 0:7, 2) +) + +slope <- function(...) { + data <- list(...) + fm <- lm(y ~ x, data = data) + coef(fm)[[2]] +} + +my_df %>% + nest(-group) %>% + mutate(slope = purrr::map(data, ~ pslide_dbl(., slope, .size = 2))) %>% + unnest()
#> group slope x y date +#> 1 a NA 1 1.5878623 2016-06-01 +#> 2 a 3.34639883 2 4.9342611 2016-06-02 +#> 3 a 2.90605561 3 7.8403167 2016-06-03 +#> 4 a -0.54513640 4 7.2951803 2016-06-04 +#> 5 a 2.71332998 5 10.0085103 2016-06-05 +#> 6 a 4.02567957 6 14.0341899 2016-06-06 +#> 7 a -1.37587595 7 12.6583139 2016-06-07 +#> 8 a 4.50066525 8 17.1589792 2016-06-08 +#> 9 b NA 8 15.7967910 2016-06-01 +#> 10 b 2.17481960 7 13.6219714 2016-06-02 +#> 11 b -0.11413960 6 13.7361110 2016-06-03 +#> 12 b 4.58135886 5 9.1547522 2016-06-04 +#> 13 b 2.11632368 4 7.0384285 2016-06-05 +#> 14 b 0.02093745 3 7.0174911 2016-06-06 +#> 15 b 4.51354479 2 2.5039463 2016-06-07 +#> 16 b 1.68876499 1 0.8151813 2016-06-08
## window over 2 months pedestrian %>% filter(Sensor == "Southern Cross Station") %>% index_by(yrmth = yearmonth(Date_Time)) %>% diff --git a/docs/reference/slider.html b/docs/reference/slider.html index 3710bc1f..a7b52b8d 100644 --- a/docs/reference/slider.html +++ b/docs/reference/slider.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1
diff --git a/docs/reference/split-by.html b/docs/reference/split-by.html index b01e175b..396139f0 100644 --- a/docs/reference/split-by.html +++ b/docs/reference/split-by.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -166,7 +166,7 @@

Examp #> # A tsibble: 14,592 x 5 [1h] #> # Key: Sensor [1] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 @@ -183,7 +183,7 @@

Examp #> # A tsibble: 16,414 x 5 [1h] #> # Key: Sensor [1] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Bourke Street Mall (North) 2015-02-17 00:00:00 2015-02-17 0 61 #> 2 Bourke Street Mall (North) 2015-02-17 01:00:00 2015-02-17 1 16 #> 3 Bourke Street Mall (North) 2015-02-17 02:00:00 2015-02-17 2 15 @@ -200,7 +200,7 @@

Examp #> # A tsibble: 17,526 x 5 [1h] #> # Key: Sensor [1] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 QV Market-Elizabeth St (West) 2015-01-01 00:00:00 2015-01-01 0 490 #> 2 QV Market-Elizabeth St (West) 2015-01-01 01:00:00 2015-01-01 1 397 #> 3 QV Market-Elizabeth St (West) 2015-01-01 02:00:00 2015-01-01 2 247 @@ -217,7 +217,7 @@

Examp #> # A tsibble: 17,539 x 5 [1h] #> # Key: Sensor [1] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Southern Cross Station 2015-01-01 00:00:00 2015-01-01 0 746 #> 2 Southern Cross Station 2015-01-01 01:00:00 2015-01-01 1 312 #> 3 Southern Cross Station 2015-01-01 02:00:00 2015-01-01 2 180 diff --git a/docs/reference/stretch.html b/docs/reference/stretch.html index 12c410d8..cd8debcf 100644 --- a/docs/reference/stretch.html +++ b/docs/reference/stretch.html @@ -84,7 +84,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -203,7 +203,7 @@

Arg .bind

If .x is a list, should .x be combined before applying .f? -If .x is a list of data frame, row binding is carried out.

+If .x is a list of data frames, row binding is carried out.

.id diff --git a/docs/reference/stretch2.html b/docs/reference/stretch2.html index dab3cf27..6526dc2c 100644 --- a/docs/reference/stretch2.html +++ b/docs/reference/stretch2.html @@ -84,7 +84,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -209,7 +209,7 @@

Arg .bind

If .x is a list, should .x be combined before applying .f? -If .x is a list of data frame, row binding is carried out.

+If .x is a list of data frames, row binding is carried out.

.id @@ -306,7 +306,30 @@

Examp #> [[2]]$z #> [1] 11 12 13 14 15 #> -#> +#>
+### +# row-wise stretching over data frame +### + +x <- as.Date("2017-01-01") + 0:364 +df <- data.frame(x = x, y = seq_along(x)) + +tibble::tibble( + data = pstretch(df, function(...) as_tibble(list(...)), .init = 10) +)
#> # A tibble: 356 x 1 +#> data +#> <list> +#> 1 <tibble [10 × 2]> +#> 2 <tibble [11 × 2]> +#> 3 <tibble [12 × 2]> +#> 4 <tibble [13 × 2]> +#> 5 <tibble [14 × 2]> +#> 6 <tibble [15 × 2]> +#> 7 <tibble [16 × 2]> +#> 8 <tibble [17 × 2]> +#> 9 <tibble [18 × 2]> +#> 10 <tibble [19 × 2]> +#> # ... with 346 more rows
@@ -167,7 +167,7 @@

Arg .bind

If .x is a list, should .x be combined before applying .f? -If .x is a list of data frame, row binding is carried out.

+If .x is a list of data frames, row binding is carried out.

... diff --git a/docs/reference/tidyverse.html b/docs/reference/tidyverse.html index 446449e8..44717f8f 100644 --- a/docs/reference/tidyverse.html +++ b/docs/reference/tidyverse.html @@ -6,7 +6,7 @@ -Tidyverse methods for tsibble — left_join.tbl_ts • tsibble +Tidyverse methods for tsibble — tidyverse • tsibble @@ -36,7 +36,7 @@ - + tsibble - 0.5.0.9000 + 0.5.1 @@ -159,6 +160,7 @@

Tidyverse methods for tsibble

be issued.

  • select(): keeps the variables you mention as well as the index.

  • transmute(): keeps the variable you operate on, as well as the index and key.

  • +
  • summarise() will not collapse on the index variable.

  • The column-wise verbs, including select(), transmute(), summarise(), mutate() & transmute(), have an additional argument of .drop = FALSE for tsibble. The index variable cannot be dropped for a tsibble. If any key variable @@ -169,28 +171,6 @@

    Tidyverse methods for tsibble

    # S3 method for tbl_ts
    -left_join(x, y, by = NULL, copy = FALSE,
    -  suffix = c(".x", ".y"), ...)
    -
    -# S3 method for tbl_ts
    -right_join(x, y, by = NULL, copy = FALSE,
    -  suffix = c(".x", ".y"), ...)
    -
    -# S3 method for tbl_ts
    -inner_join(x, y, by = NULL, copy = FALSE,
    -  suffix = c(".x", ".y"), ...)
    -
    -# S3 method for tbl_ts
    -full_join(x, y, by = NULL, copy = FALSE,
    -  suffix = c(".x", ".y"), ...)
    -
    -# S3 method for tbl_ts
    -semi_join(x, y, by = NULL, copy = FALSE, ...)
    -
    -# S3 method for tbl_ts
    -anti_join(x, y, by = NULL, copy = FALSE, ...)
    -
    -# S3 method for tbl_ts
     arrange(.data, ...)
     
     # S3 method for grouped_ts
    @@ -226,6 +206,28 @@ 

    Tidyverse methods for tsibble

    # S3 method for grouped_ts ungroup(x, ...) +# S3 method for tbl_ts +left_join(x, y, by = NULL, copy = FALSE, + suffix = c(".x", ".y"), ...) + +# S3 method for tbl_ts +right_join(x, y, by = NULL, copy = FALSE, + suffix = c(".x", ".y"), ...) + +# S3 method for tbl_ts +inner_join(x, y, by = NULL, copy = FALSE, + suffix = c(".x", ".y"), ...) + +# S3 method for tbl_ts +full_join(x, y, by = NULL, copy = FALSE, + suffix = c(".x", ".y"), ...) + +# S3 method for tbl_ts +semi_join(x, y, by = NULL, copy = FALSE, ...) + +# S3 method for tbl_ts +anti_join(x, y, by = NULL, copy = FALSE, ...) + # S3 method for tbl_ts gather(data, key = "key", value = "value", ..., na.rm = FALSE, convert = FALSE, factor_key = FALSE) @@ -244,9 +246,33 @@

    Tidyverse methods for tsibble

    Arguments

    + + + + + + + + + + + + + + + + + + + + - + @@ -275,30 +301,6 @@

    Arg

    - - - - - - - - - - - - - - - - - - - - @@ -385,19 +387,13 @@

    Arg

    .data

    A tbl_ts.

    ...

    same arguments accepted as its dplyr generic.

    .by_group

    If TRUE, will sort first by grouping variable. Applies to +grouped data frames only.

    .drop

    FALSE returns a tsibble object as the input. TRUE drops a +tsibble and returns a tibble.

    add

    When add = FALSE, the default, group_by() will +override existing groups. To add to the existing groups, use +add = TRUE.

    x

    tbls to join

    A tbl()

    y

    If there are non-joined duplicate variables in x and y, these suffixes will be added to the output to disambiguate them. Should be a character vector of length 2.

    ...

    same arguments accepted as its dplyr generic.

    .data

    A tbl_ts.

    .by_group

    If TRUE, will sort first by grouping variable. Applies to -grouped data frames only.

    .drop

    FALSE returns a tsibble object as the input. TRUE drops a -tsibble and returns a tibble.

    add

    When add = FALSE, the default, group_by() will -override existing groups. To add to the existing groups, use -add = TRUE.

    data
    -

    Details

    - -
      -
    • summarise() will not collapse on the index variable.

    • -
    -

    Examples

    # Sum over sensors ---- pedestrian %>% summarise(Total = sum(Count))
    #> # A tsibble: 17,542 x 2 [1h] #> Date_Time Total -#> * <dttm> <int> +#> <dttm> <int> #> 1 2015-01-01 00:00:00 2866 #> 2 2015-01-01 01:00:00 1535 #> 3 2015-01-01 02:00:00 994 @@ -413,7 +409,7 @@

    Examp index_by(Date) %>% summarise(Total = sum(Count))

    #> # A tsibble: 731 x 2 [1D] #> Date Total -#> * <date> <int> +#> <date> <int> #> 1 2015-01-01 18079 #> 2 2015-01-02 19306 #> 3 2015-01-03 12708 @@ -435,7 +431,7 @@

    Examp #> # Key: Region | State [77] #> # Groups: Region [77] #> Region State Quarter geo_trips -#> * <chr> <chr> <qtr> <dbl> +#> <chr> <chr> <qtr> <dbl> #> 1 Adelaide South Australia 1998 Q1 659. #> 2 Adelaide South Australia 1998 Q2 450. #> 3 Adelaide South Australia 1998 Q3 593. @@ -454,18 +450,18 @@

    Examp Z = rnorm(10, 0, 4) )

    #> The `index` is `time`.
    stocks %>% gather(stock, price, -time)
    #> # A tsibble: 30 x 3 [1D] #> # Key: stock [3] -#> time stock price -#> * <date> <chr> <dbl> -#> 1 2009-01-01 X -0.412 -#> 2 2009-01-02 X 0.934 -#> 3 2009-01-03 X 1.84 -#> 4 2009-01-04 X -0.705 -#> 5 2009-01-05 X 0.00851 -#> 6 2009-01-06 X 2.03 -#> 7 2009-01-07 X -1.34 -#> 8 2009-01-08 X 1.16 -#> 9 2009-01-09 X -0.203 -#> 10 2009-01-10 X -0.378 +#> time stock price +#> <date> <chr> <dbl> +#> 1 2009-01-01 X 0.630 +#> 2 2009-01-02 X 2.10 +#> 3 2009-01-03 X -0.614 +#> 4 2009-01-04 X -1.63 +#> 5 2009-01-05 X -0.0104 +#> 6 2009-01-06 X -0.657 +#> 7 2009-01-07 X -0.670 +#> 8 2009-01-08 X -0.479 +#> 9 2009-01-09 X 1.32 +#> 10 2009-01-10 X 0.637 #> # ... with 20 more rows
    # example from tidyr stocks <- tsibble( time = as.Date('2009-01-01') + 0:9, @@ -474,18 +470,18 @@

    Examp Z = rnorm(10, 0, 4) )

    #> The `index` is `time`.
    stocksm <- stocks %>% gather(stock, price, -time) stocksm %>% spread(stock, price)
    #> # A tsibble: 10 x 4 [1D] -#> time X Y Z -#> * <date> <dbl> <dbl> <dbl> -#> 1 2009-01-01 0.581 0.908 -5.63 -#> 2 2009-01-02 -0.178 -1.70 2.84 -#> 3 2009-01-03 0.741 1.13 -4.96 -#> 4 2009-01-04 -0.997 2.30 -1.47 -#> 5 2009-01-05 -2.94 -1.51 1.85 -#> 6 2009-01-06 0.719 -0.979 -1.29 -#> 7 2009-01-07 -0.698 -2.33 -5.15 -#> 8 2009-01-08 -1.89 -0.959 -4.12 -#> 9 2009-01-09 0.0763 0.231 6.06 -#> 10 2009-01-10 0.875 -3.54 1.39
    pedestrian %>% +#> time X Y Z +#> <date> <dbl> <dbl> <dbl> +#> 1 2009-01-01 -1.17 -2.57 0.0143 +#> 2 2009-01-02 -0.480 -2.06 -1.42 +#> 3 2009-01-03 0.115 3.03 4.59 +#> 4 2009-01-04 -1.77 0.694 -0.885 +#> 5 2009-01-05 -1.41 3.56 4.07 +#> 6 2009-01-06 0.709 0.773 -1.05 +#> 7 2009-01-07 -1.24 -1.84 6.63 +#> 8 2009-01-08 -0.368 -3.17 -3.10 +#> 9 2009-01-09 0.462 -0.168 -3.70 +#> 10 2009-01-10 -0.323 -4.17 -1.10
    pedestrian %>% nest(-Sensor)
    #> # A tibble: 4 x 2 #> Sensor data #> * <chr> <list> @@ -506,7 +502,7 @@

    Examp unnest(key = id(Sensor))

    #> # A tsibble: 66,071 x 5 [1h] #> # Key: Sensor [4] #> Sensor Date_Time Date Time Count -#> * <chr> <dttm> <date> <int> <int> +#> <chr> <dttm> <date> <int> <int> #> 1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01 0 1630 #> 2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01 1 826 #> 3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01 2 567 @@ -521,9 +517,9 @@

    Examp nest(-Region, -State) nested_tourism %>% unnest(key = id(Region | State))

    #> # A tsibble: 23,408 x 5 [1Q] -#> # Key: Region | State, Purpose [308] +#> # Key: Purpose, Region | State [308] #> Region State Quarter Purpose Trips -#> * <chr> <chr> <qtr> <chr> <dbl> +#> <chr> <chr> <qtr> <chr> <dbl> #> 1 Adelaide South Australia 1998 Q1 Business 135. #> 2 Adelaide South Australia 1998 Q2 Business 110. #> 3 Adelaide South Australia 1998 Q3 Business 166. @@ -540,9 +536,7 @@

    Examp

    Contents

    diff --git a/docs/reference/tile.html b/docs/reference/tile.html index 3969063e..4365fe78 100644 --- a/docs/reference/tile.html +++ b/docs/reference/tile.html @@ -84,7 +84,7 @@ tsibble - 0.5.0.9000 + 0.5.1
    @@ -154,11 +154,11 @@

    Tiling window calculation

    -
    tile(.x, .f, ..., .size = 1)
    +    
    tile(.x, .f, ..., .size = 1, .bind = FALSE)
     
    -tile_dfr(.x, .f, ..., .size = 1, .id = NULL)
    +tile_dfr(.x, .f, ..., .size = 1, .bind = FALSE, .id = NULL)
     
    -tile_dfc(.x, .f, ..., .size = 1)
    +tile_dfc(.x, .f, ..., .size = 1, .bind = FALSE)

    Arguments

    @@ -194,6 +194,11 @@

    Arg

    + + + + diff --git a/docs/reference/tile2.html b/docs/reference/tile2.html index 32645e0d..e71d27dd 100644 --- a/docs/reference/tile2.html +++ b/docs/reference/tile2.html @@ -84,7 +84,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -154,17 +154,17 @@

    Tiling window calculation over multiple inputs simultaneously

    -
    tile2(.x, .y, .f, ..., .size = 1)
    +    
    tile2(.x, .y, .f, ..., .size = 1, .bind = FALSE)
     
    -tile2_dfr(.x, .y, .f, ..., .size = 1, .id = NULL)
    +tile2_dfr(.x, .y, .f, ..., .size = 1, .bind = FALSE, .id = NULL)
     
    -tile2_dfc(.x, .y, .f, ..., .size = 1)
    +tile2_dfc(.x, .y, .f, ..., .size = 1, .bind = FALSE)
     
    -ptile(.l, .f, ..., .size = 1)
    +ptile(.l, .f, ..., .size = 1, .bind = FALSE)
     
    -ptile_dfr(.l, .f, ..., .size = 1, .id = NULL)
    +ptile_dfr(.l, .f, ..., .size = 1, .bind = FALSE, .id = NULL)
     
    -ptile_dfc(.l, .f, ..., .size = 1)
    +ptile_dfc(.l, .f, ..., .size = 1, .bind = FALSE)

    Arguments

    .size

    An integer for window size. If positive, moving forward from left to right; if negative, moving backward (from right to left).

    .bind

    If .x is a list, should .x be combined before applying .f? +If .x is a list of data frames, row binding is carried out.

    .id
    @@ -204,6 +204,11 @@

    Arg

    + + + + diff --git a/docs/reference/tiler.html b/docs/reference/tiler.html index 01ed337d..3ebb88cc 100644 --- a/docs/reference/tiler.html +++ b/docs/reference/tiler.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -144,9 +144,9 @@

    Splits the input to a list according to the tiling window size.

    -
    tiler(.x, .size = 1)
    +    
    tiler(.x, .size = 1, .bind = FALSE)
     
    -ptiler(..., .size = 1)
    +ptiler(..., .size = 1, .bind = FALSE)

    Arguments

    .size

    An integer for window size. If positive, moving forward from left to right; if negative, moving backward (from right to left).

    .bind

    If .x is a list, should .x be combined before applying .f? +If .x is a list of data frames, row binding is carried out.

    .id
    @@ -159,6 +159,11 @@

    Arg

    + + + + diff --git a/docs/reference/time_unit.html b/docs/reference/time_unit.html index bd57ce80..c8e329d2 100644 --- a/docs/reference/time_unit.html +++ b/docs/reference/time_unit.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/reference/tourism.html b/docs/reference/tourism.html index 1bce43f5..eeb9e786 100644 --- a/docs/reference/tourism.html +++ b/docs/reference/tourism.html @@ -80,7 +80,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -189,7 +189,7 @@

    Examp #> # Key: Region | State [77] #> # Groups: Region [77] #> Region State Quarter Total_Trips -#> * <chr> <chr> <qtr> <dbl> +#> <chr> <chr> <qtr> <dbl> #> 1 Adelaide South Australia 1998 Q1 659. #> 2 Adelaide South Australia 1998 Q2 450. #> 3 Adelaide South Australia 1998 Q3 593. diff --git a/docs/reference/tsibble-package.html b/docs/reference/tsibble-package.html index 1a7df652..a0f89173 100644 --- a/docs/reference/tsibble-package.html +++ b/docs/reference/tsibble-package.html @@ -82,7 +82,7 @@ tsibble - 0.5.0.9000 + 0.5.1 @@ -239,18 +239,18 @@

    Examp key = id(), index = date ) tsbl1
    #> # A tsibble: 10 x 2 [1D] -#> date value -#> * <date> <dbl> -#> 1 2017-01-01 1.78 -#> 2 2017-01-02 0.387 -#> 3 2017-01-03 -0.919 -#> 4 2017-01-04 -1.58 -#> 5 2017-01-05 -0.0841 -#> 6 2017-01-06 -2.09 -#> 7 2017-01-07 0.00357 -#> 8 2017-01-08 -0.356 -#> 9 2017-01-09 1.15 -#> 10 2017-01-10 -0.221
    +#> date value +#> <date> <dbl> +#> 1 2017-01-01 -0.593 +#> 2 2017-01-02 -0.122 +#> 3 2017-01-03 1.18 +#> 4 2017-01-04 0.641 +#> 5 2017-01-05 -0.630 +#> 6 2017-01-06 -0.808 +#> 7 2017-01-07 -0.860 +#> 8 2017-01-08 -2.17 +#> 9 2017-01-09 -1.38 +#> 10 2017-01-10 -0.493
    # create a tsibble with one key ---- tsbl2 <- tsibble( qtr = rep(yearquarter(seq(2010, 2012.25, by = 1 / 4)), 3), @@ -261,17 +261,17 @@

    Examp tsbl2

    #> # A tsibble: 30 x 3 [1Q] #> # Key: group [3] #> qtr group value -#> * <qtr> <chr> <dbl> -#> 1 2010 Q1 x 1.02 -#> 2 2010 Q2 x -0.264 -#> 3 2010 Q3 x 1.66 -#> 4 2010 Q4 x -0.774 -#> 5 2011 Q1 x -0.924 -#> 6 2011 Q2 x -0.276 -#> 7 2011 Q3 x -0.593 -#> 8 2011 Q4 x -0.122 -#> 9 2012 Q1 x 1.18 -#> 10 2012 Q2 x 0.641 +#> <qtr> <chr> <dbl> +#> 1 2010 Q1 x -0.582 +#> 2 2010 Q2 x -0.167 +#> 3 2010 Q3 x 0.486 +#> 4 2010 Q4 x -1.33 +#> 5 2011 Q1 x -0.262 +#> 6 2011 Q2 x 0.652 +#> 7 2011 Q3 x 0.749 +#> 8 2011 Q4 x 0.897 +#> 9 2012 Q1 x 1.49 +#> 10 2012 Q2 x -0.659 #> # ... with 20 more rows
    @@ -259,18 +259,18 @@

    Examp key = id(), index = date ) tsbl1
    #> # A tsibble: 10 x 2 [1D] -#> date value -#> * <date> <dbl> -#> 1 2017-01-01 0.0645 -#> 2 2017-01-02 -0.265 -#> 3 2017-01-03 -0.447 -#> 4 2017-01-04 -1.41 -#> 5 2017-01-05 -0.506 -#> 6 2017-01-06 -0.270 -#> 7 2017-01-07 -1.09 -#> 8 2017-01-08 0.362 -#> 9 2017-01-09 -0.336 -#> 10 2017-01-10 1.36
    +#> date value +#> <date> <dbl> +#> 1 2017-01-01 0.687 +#> 2 2017-01-02 0.705 +#> 3 2017-01-03 0.991 +#> 4 2017-01-04 1.14 +#> 5 2017-01-05 -1.24 +#> 6 2017-01-06 2.65 +#> 7 2017-01-07 -0.157 +#> 8 2017-01-08 -0.423 +#> 9 2017-01-09 -0.198 +#> 10 2017-01-10 -0.895
    # create a tsibble with one key ---- tsbl2 <- tsibble( qtr = rep(yearquarter(seq(2010, 2012.25, by = 1 / 4)), 3), @@ -281,17 +281,17 @@

    Examp tsbl2

    #> # A tsibble: 30 x 3 [1Q] #> # Key: group [3] #> qtr group value -#> * <qtr> <chr> <dbl> -#> 1 2010 Q1 x -0.712 -#> 2 2010 Q2 x 0.662 -#> 3 2010 Q3 x 0.291 -#> 4 2010 Q4 x 0.198 -#> 5 2011 Q1 x -1.20 -#> 6 2011 Q2 x -0.0398 -#> 7 2011 Q3 x 0.687 -#> 8 2011 Q4 x 0.705 -#> 9 2012 Q1 x 0.991 -#> 10 2012 Q2 x 1.14 +#> <qtr> <chr> <dbl> +#> 1 2010 Q1 x 0.904 +#> 2 2010 Q2 x 0.0796 +#> 3 2010 Q3 x -1.26 +#> 4 2010 Q4 x 1.03 +#> 5 2011 Q1 x -0.731 +#> 6 2011 Q2 x -0.190 +#> 7 2011 Q3 x 0.529 +#> 8 2011 Q4 x 0.550 +#> 9 2012 Q1 x 0.550 +#> 10 2012 Q2 x -0.660 #> # ... with 20 more rows
    diff --git a/docs/reference/units_since.html b/docs/reference/units_since.html index c04d9d54..138144ad 100644 --- a/docs/reference/units_since.html +++ b/docs/reference/units_since.html @@ -79,7 +79,7 @@ tsibble - 0.5.0.9000 + 0.5.1 diff --git a/docs/sitemap.xml b/docs/sitemap.xml index d593a90e..9da69201 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -69,6 +69,9 @@ https://pkg.earo.me/tsibble/reference/measured-vars.html + + https://pkg.earo.me/tsibble/reference/new_interval.html + https://pkg.earo.me/tsibble/reference/pedestrian.html

    .size

    An integer for window size. If positive, moving forward from left to right; if negative, moving backward (from right to left).

    .bind

    If .x is a list or data frame, the input will be flattened +to a list of data frames.

    ...