| get_nth_release | R Documentation |
Filters the input dataset to return the Nth release (or vintage) of data for each time period. The function supports selecting the first, latest, or a specific numbered release.
get_nth_release(df, n = 0, diagonal = FALSE)
df |
A data frame containing data vintages. The data frame must include the columns:
|
n |
The release number to extract. Accepts:
|
diagonal |
Logical. If |
The behavior depends on the value of n:
Non-negative integer: The function retrieves the Nth release for each time period (e.g., 0 = first release, 1 = second release, etc.).
"first": Retrieves the first release for each time
period (via get_first_release).
"latest": Retrieves the most recent release for each time
period (via get_latest_release).
A filtered data frame containing only the specified release(s).
The resulting data frame is assigned the class tbl_release to indicate
its structure. If diagonal is set to TRUE, the function only returns the
real first releases. That is historic values for which no vintages exist
are not returned.
Other revision utilities:
get_days_to_release(),
get_first_release(),
get_fixed_release(),
get_latest_release(),
get_releases_by_date(),
get_revisions()
# Example data
df <- dplyr::filter(reviser::gdp, id == "US")
# Get the first release (n = 0)
first_release <- get_nth_release(df, n = 0)
# Get the latest release
latest_release <- get_nth_release(df, n = "latest")
# Get the second release (n = 1)
second_release <- get_nth_release(df, n = 1)
# Get the first and second release (n = 0:1)
releases <- get_nth_release(df, n = 0:1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.