TimeSeriesWithRevisions-class {MacrobondAPI}R Documentation

TimeSeriesWithRevisions class

Description

A TimeSeriesWithRevisions object represents the complete history of a time series downloaded from the Macrobond database

Objects from the Class

TimeSeriesWithRevisions objects are created by the following methods: FetchOneTimeSeriesWithRevisions FetchTimeSeriesWithRevisions

Methods

getIsError

signature(series = "TimeSeriesWithRevisions"): TRUE if there was an error downloading this time series. In that case the getErrorMessage method will return an error message.

getErrorMessage

signature(series = "TimeSeriesWithRevisions"): Get an error message text if getIsError is TRUE.

getHead

signature(object = "TimeSeriesWithRevisions"): Get the current state of the series.

getVintage

signature(object = "TimeSeriesWithRevisions", date = "Date"): Get the state of the series at the specified time.

getVintageTimes

signature(object = "TimeSeriesWithRevisions"): Get the times for all revisions for the series.

getHasRevisions

signature(object = "TimeSeriesWithRevisions"): Check if the series has any revisions.

getStoresRevisions

signature(object = "TimeSeriesWithRevisions"): Check if the series is set to store revisions.

getNthRelease

signature(object = "TimeSeriesWithRevisions", n = "Int"): Get the series at the specified release. You can use getRevisionTimesFromNthRelease to get the revision dates per observation for these series.

getObservationHistory

signature(object = "TimeSeriesWithRevisions", date = "Date"): Get the values over time for a specific point in time.

getCompleteHistory

signature(object = "TimeSeriesWithRevisions"): Get all the revisions as a separate complete series. Each element in the list is a list with two elements: timestamp and series. The timestamp of the first series is typically not known and set to 1899-12-29 or null.

show

signature(object = "TimeSeriesWithRevisions"): Show a summary of the time series with revisions.

Note

The series returned from getHead, getVintage, getNthRelease and getCompleteHistory will all be of equal length. This makes it easy to use them together in a data frame, but it also means that they can contain missing values at the end of the series.

See Also

FetchOneTimeSeriesWithRevisions, FetchTimeSeriesWithRevisions, getRevisionTimesFromNthRelease,

Examples

# Fetch revision history for usgdp and get series for first and second release
seriesGdp <- FetchOneTimeSeriesWithRevisions("usgdp")
firstRelease <- getNthRelease(seriesGdp, 0)
secondRelease <- getNthRelease(seriesGdp, 1)
x <- MakeXtsFromUnifiedResponse(c(firstRelease, secondRelease))
plot(x)

# Show the timestamps for each value of the first release
show(getRevisionTimesFromNthRelease(firstRelease))

# Load the series revisions and get the vintage series that shows what it looked like at 2018-01-01
seriesWithRevisions <- FetchOneTimeSeriesWithRevisions("usgdp")
series2018 <- getVintage(seriesWithRevisions, as.POSIXct("2018-01-01 18:00:00", tz = "EST"))

[Package MacrobondAPI version 1.1-5 Index]