TimeSeries-class {MacrobondAPI} | R Documentation |
A TimeSeries object represents a time series downloaded via the Macrobond API or a time series that is to be uploaded to the Macrobond in-house database.
A time series consists of a vector of values, a calendar and a set of metadata.
The vector of values consists of floating point values. A missing value is represented by a NaN. To test if a value is a NaN in R, you use the method is.nan(value). To represent a NaN you can use the constant NaN. NB! You must never use this constant to compare if a value is NaN; always use is.nan(value) to test if a value is NaN.
A missing value typically means that a value was expected, but it is missing for some reason. When you do a unified series request, you have the option of specifying what method, if any, that should be used to fill in missing values.
The calendar is exposed as lists of dates as well as a couple of methods to go between index in the list of values and a date. Each time series has a frequency and a start date. Daily series also have information about what weekdays that are covered. In addition to this, certain dates can be skipped. This is mostly used for daily series when there is a holiday or other day when the market is closed. It is not common, but you may find skipped dates in series of other frequencies too. For instance, some Chinese monthly data is not reported for February and this month is then skipped.
Time series objects are created by the following methods:
FetchOneTimeSeries
FetchTimeSeries
CreateTimeSeriesObject
CreateTimeSeriesObjectWithForecastFlags
UploadOneOrMoreTimeSeries
TimeSeriesWithRevisions
Class "Entity"
, directly.
signature(object = "Entity")
: Get the name of the time series. This will always be the name used in the request.
signature(object = "Entity")
: Get the primary name of the time series. This can differ from the name used in the request when that name is a alias or relative reference.
signature(series = "Entity")
: Get the title of the time series.
signature(series = "Entity")
: TRUE if there was an error downloading this time series. In that case the getErrorMessage method will return an error message.
signature(series = "Entity")
: Get an error message text if getIsError is TRUE.
signature(series = "Entity")
: Get a Metadata
object for this time series.
signature(series = "TimeSeries")
: Get a vector of all the values of the time series.
signature(series = "TimeSeries")
: Get a vector containg the Date
at the start of each period.
signature(series = "TimeSeries")
: Get a vector containg the Date
at the end of each period.
signature(series = "TimeSeries")
: Get a vector with a logical
for each value that tells if the value is a forecast or not.
signature(object = "TimeSeries")
: Get the start date of the time series.
signature(object = "TimeSeries")
: Get the end date of the time series.
signature(object = "TimeSeries")
: Get the frequency of the time series as one of the values in TimeSeriesFrequency
.
signature(object = "TimeSeries")
: Get a bit set of what weekdays that are used for daily timeseries. The bits are defined for Monday-Sunday in the list TimeSeriesWeekdays
.
signature(series = "TimeSeries", date = "Date")
: Get the value at or preceding a specific date.
signature(series = "TimeSeries", date = "Date")
: Get the index in the value and date vectors at or preceding a specific date.
signature(series = "TimeSeries")
: The typical number of observations per year based on the frequency of the series.
signature(object = "Entity")
: Get a list "concepts" for which this series is defined or NULL
if not defined. This method is a convenience method for retrieving the value of the RegionKey
metadata attribute. See also GetConceptDescription
and SearchByConcept
.
signature(series = "TimeSeries")
: Get a vector of POSIXlt
for when the value was revised. This only works for series retrieved from getNthRelease
.
signature(object = "TimeSeries")
: Show a summary of the time series.
signature(x = "TimeSeries")
: Show a simple plot of the time series. Additional parameters will be passed on to the link[graphics]{plot}
function.
FetchOneTimeSeries
,
FetchTimeSeries
,
CreateTimeSeriesObject
,
CreateTimeSeriesObjectWithForecastFlags
,
UploadOneOrMoreTimeSeries
seriesGdp <- FetchOneTimeSeries("usgdp") show(seriesGdp)