question

Upvotes
Accepted
27 6 5 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
78.8k 250 52 74

@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 6 5 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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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