question

Upvotes
Accepted
27 4 4 4

How to get time series of forecast data in R API

I am trying to get time series data for a series that contains actual and forecast data.


However I am getting an error when I use the following code:

inflation1    <- dsws$timeSeriesRequest(instrument = "AUOCFCOR",
                                    datatype   = "",
                                    startDate  = "-2Y"
                                    endDate    = "-0D",
                                    frequency  = "Y") 

The error messages that I get in the console are:

> inflation1    <- dsws$timeSeriesRequest(instrument = "AUOCFCOR",
+                                     datatype   = "",
+                                     startDate  = ""
+                                     endDate    = "",
Error: unexpected symbol in:
"                                    startDate  = ""
                                    endDate"
>                                     frequency  = "Y")
Error: unexpected ')' in "                                    frequency  = "Y")"
> 


What am I doing wrong here?

datastream-apidsws-apirr-studio
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
56.3k 145 45 65

@Ed_J

From the code, I think that a comma is missing in the startDate parameter.

If it has a comma, it can get the data properly.

> inflations <- mydsws$timeSeriesRequest(instrument="AUOCFCOR",
+ datatype="",
+ startDate="-2Y",
+ endDate="-0D",
+ frequency="Y")
> inflations
           AUOCFCOR
2017-06-30  101.701
2018-06-29  103.380
2019-06-28  105.151



r.png (6.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
27 4 4 4

Thanks you! I can't believe I missed such an obvious error.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.