Skip to content

Commit

Permalink
more lifecycles
Browse files Browse the repository at this point in the history
  • Loading branch information
earowang committed Jul 29, 2019
1 parent 2c79596 commit c4d7d24
Show file tree
Hide file tree
Showing 37 changed files with 94 additions and 13 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# tsibble 0.8.2.9000

* Added lifecycle badges to functions.
* `index_by()` supports lambda expression (#91).
* Defunct argument `gather` in `as_tsibble.mts()` in favour of `pivot_longer`.
* `yearweek()` handles characters containing keywords "W"/"Wk"/"Week", for example `yearweek("2019 W03")`.
Expand Down
18 changes: 18 additions & 0 deletions R/as-tsibble.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#' Create a tsibble object
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' @param ... A set of name-value pairs. The names of "key" and "index" should
#' be avoided as they are used as the arguments.
#' @param key Unquoted variable(s) that uniquely determine time indices. `NULL` for
Expand Down Expand Up @@ -152,6 +155,9 @@ as_tsibble.NULL <- function(x, ...) {

#' Update key and index for a tsibble
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("maturing")}
#'
#' @param x A tsibble.
#' @inheritParams as_tsibble
#' @details
Expand Down Expand Up @@ -197,6 +203,9 @@ update_tsibble <- function(x, key, index, regular = is_regular(x),

#' Low-level constructor for a tsibble object
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("maturing")}
#'
#' `build_tsibble()` creates a `tbl_ts` object with more controls. It is useful
#' for creating a `tbl_ts` internally inside a function, and it allows developers to
#' determine if the time needs ordering and the interval needs calculating.
Expand Down Expand Up @@ -287,6 +296,9 @@ build_tsibble <- function(x, key = NULL, key_data = NULL, index, index2 = index,

#' Low-level & high-performance constructor for a tsibble object
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("experimental")}
#'
#' `build_tsibble_meta()` does much less checks than `build_tsibble()` for
#' high performance.
#'
Expand Down Expand Up @@ -336,6 +348,9 @@ build_tsibble_meta <- function(x, key_data = NULL, index, index2,

#' Create a subclass of a tsibble
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("maturing")}
#'
#' @param x A `tbl_ts`, required.
#' @param ... Name-value pairs defining new attributes other than a tsibble.
#' @param class Subclasses to assign to the new object, default: none.
Expand Down Expand Up @@ -474,6 +489,9 @@ as.data.frame.tbl_ts <- function(x, row.names = NULL, optional = FALSE, ...) {

#' Test duplicated observations determined by key and index variables
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' * `is_duplicated()`: a logical scalar if the data exist duplicated observations.
#' * `are_duplicated()`: a logical vector, the same length as the row number of `data`.
#' * `duplicates()`: identical key-index data entries.
Expand Down
3 changes: 3 additions & 0 deletions R/dplyr-verbs.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ group_by.tbl_ts <- function(.data, ..., add = FALSE,

#' Group by key variables
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' @param .data A `tbl_ts` object.
#' @param ... Ignored.
#' @inheritParams dplyr::group_by
Expand Down
3 changes: 3 additions & 0 deletions R/filter-index.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ filter_index <- function(.data, ..., .preserve = FALSE) {

#' If time falls in the ranges using compact expressions
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("maturing")}
#'
#' This function respects time zone and encourages compact expressions.
#'
#' @param x A vector of time index, such as classes `POSIXct`, `Date`, `yearweek`,
Expand Down
1 change: 1 addition & 0 deletions R/index-by.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' `index_by()` is the counterpart of `group_by()` in temporal context, but it
#' only groups the time index. The following operation is applied to each partition
#' of the index, similar to `group_by()` but dealing with index only.
Expand Down
3 changes: 3 additions & 0 deletions R/index-valid.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#' Add custom index support for a tsibble
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("maturing")}
#'
#' S3 method to add an index type support for a tsibble.
#'
#' @param x An object of index type that the tsibble supports.
Expand Down
2 changes: 0 additions & 2 deletions R/new-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ new_data.tbl_ts <- function(.data, n = 1L, keep_all = FALSE, ...) {
}

#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("maturing")}
#'
#' `append_row()`: add new rows to the end of a tsibble by filling a key-index
#' pair and `NA` for measured variables.
#'
Expand Down
3 changes: 3 additions & 0 deletions R/period.R
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ as.POSIXlt.yearquarter <- function(x, tz = "", ...) {

#' Time units since Unix Epoch
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("questioning")}
#'
#' @param x An object of `POSIXct`, `Date`, `yearweek`, `yearmonth`, `yearquarter`.
#'
#' @details
Expand Down
6 changes: 6 additions & 0 deletions R/slide.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ replace_fn_names <- function(fn, replace = list(), ns = NULL) {

#' Sliding window calculation
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' Rolling window with overlapping observations:
#' * `slide()` always returns a list.
#' * `slide_lgl()`, `slide_int()`, `slide_dbl()`, `slide_chr()` use the same
Expand Down Expand Up @@ -123,6 +126,9 @@ slide_dfc <- function(.x, .f, ..., .size = 1, .step = 1, .fill = NA,

#' Sliding window calculation over multiple inputs simultaneously
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' Rolling window with overlapping observations:
#' * `slide2()` and `pslide()` always returns a list.
#' * `slide2_lgl()`, `slide2_int()`, `slide2_dbl()`, `slide2_chr()` use the same
Expand Down
6 changes: 6 additions & 0 deletions R/stretch.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ nrow2 <- function(.x) {

#' Stretching window calculation
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' Fixing an initial window and expanding more observations:
#' * `stretch()` always returns a list.
#' * `stretch_lgl()`, `stretch_int()`, `stretch_dbl()`, `stretch_chr()` use the same
Expand Down Expand Up @@ -78,6 +81,9 @@ stretch_dfc <- function(.x, .f, ..., .step = 1, .init = 1, .fill = NA,

#' Stretching window calculation over multiple simultaneously
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' Fixing an initial window and expanding more observations:
#' * `stretch2()` and `pstretch()` always returns a list.
#' * `stretch2_lgl()`, `stretch2_int()`, `stretch2_dbl()`, `stretch2_chr()` use the same
Expand Down
6 changes: 6 additions & 0 deletions R/tile.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#' Tiling window calculation
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' Tiling window without overlapping observations:
#' * `tile()` always returns a list.
#' * `tile_lgl()`, `tile_int()`, `tile_dbl()`, `tile_chr()` use the same
Expand Down Expand Up @@ -54,6 +57,9 @@ tile_dfc <- function(.x, .f, ..., .size = 1, .bind = FALSE) {

#' Tiling window calculation over multiple inputs simultaneously
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' Tiling window without overlapping observations:
#' * `tile2()` and `ptile()` always returns a list.
#' * `tile2_lgl()`, `tile2_int()`, `tile2_dbl()`, `tile2_chr()` use the same
Expand Down
3 changes: 3 additions & 0 deletions R/time-wise.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#' Lagged differences
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' @param x A numeric vector.
#' @param lag An positive integer indicating which lag to use.
#' @param differences An positive integer indicating the order of the difference.
Expand Down
4 changes: 4 additions & 0 deletions R/tsibble-meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ is_ordered <- function(x) {

#' If the object is a tsibble
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#'
#' @param x An object.
#'
#' @return TRUE if the object inherits from the tbl_ts class.
Expand Down
3 changes: 3 additions & 0 deletions R/tsibble2ts.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ time.POSIXt <- function(x, frequency = NULL, ...) {

#' Guess a time frequency from other index objects
#'
#' @description
#' \Sexpr[results=rd, stage=render]{tsibble:::lifecycle("stable")}
#'
#' A possible frequency passed to the `ts()` function
#'
#' @param x An index object including "yearmonth", "yearquarter", "Date" and others.
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ output:
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/tidyverts/tsibble?branch=master&svg=true)](https://ci.appveyor.com/project/tidyverts/tsibble)
[![Coverage Status](https://codecov.io/gh/tidyverts/tsibble/branch/master/graph/badge.svg)](https://codecov.io/github/tidyverts/tsibble?branch=master)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/tsibble)](https://cran.r-project.org/package=tsibble)
[![Downloads](http://cranlogs.r-pkg.org/badges/tsibble?color=brightgreen)](https://cran.r-project.org/package=tsibble)
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)

```{r, echo = FALSE}
knitr::opts_chunk$set(
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Status](https://ci.appveyor.com/api/projects/status/github/tidyverts/tsibble?bra
[![Coverage
Status](https://codecov.io/gh/tidyverts/tsibble/branch/master/graph/badge.svg)](https://codecov.io/github/tidyverts/tsibble?branch=master)
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/tsibble)](https://cran.r-project.org/package=tsibble)
[![Downloads](http://cranlogs.r-pkg.org/badges/tsibble?color=brightgreen)](https://cran.r-project.org/package=tsibble)
[![Lifecycle:
maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)

The **tsibble** package provides a data infrastructure for tidy temporal
data with wrangling tools. Adhering to the [tidy data
Expand Down
2 changes: 2 additions & 0 deletions man/build_tsibble.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/build_tsibble_meta.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/difference.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/duplicates.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/group_by_key.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/guess_frequency.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/index-by.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/index_valid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/is-tsibble.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions man/new-data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/new_tsibble.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/slide.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/slide2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/stretch.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/stretch2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/tile.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/tile2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/time_in.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tsibble.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c4d7d24

Please sign in to comment.