Skip to contents

Filters the input dataset to return the most recent release (or vintage) for each time period.

Usage

get_latest_release(df)

Arguments

df

A data frame containing data vintages. The data frame must include the columns pub_date (publication date of the release) and time (the corresponding time period for the data).

Value

A filtered data frame containing only the most recent release(s). The resulting data frame is assigned the class tbl_release to indicate its structure.

Details

For each time period, the function identifies the release with the latest publication date (pub_date) and adds a column release that labels the release as release_N, where N is the release index (zero indexed).

Examples

# Example data
df <- dplyr::filter(reviser::gdp, id=="US")

# Get the latest release for each time period
latest_release <- get_latest_release(df)