Why R-studio does not recognize XML query and tries to parse it as a JSON?

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. You've done the next best however, by including all your code and data in a code block. Thanks. In the future, though, avoid install.packages() in favor of require(), which will offer the option to install the package rather than just going ahead and installing it.

DataflowMethod() isn't given an argument is the problem.

Let's look under the hood to see exactly where that happens with and without

DataStructureMethod() # NO ARGUMENT PROVIDED
#> Error in paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/", : argument "databaseID" is missing, with no default
#> Warning: JSON string contains (illegal) UTF8 byte-order-mark!
#> Error: lexical error: invalid char in json text.
#>                                        <?xml version="1.0" encoding="u
#>                      (right here) ------^

available.codes <- DataStructureMethod('IFS')
#>   CodeValue  CodeText
#> 1         A    Annual
#> 2         B Bi-annual
#> 3         Q Quarterly
#> 4         M   Monthly
#> 5         D     Daily
#> 6         W    Weekly

Created on 2020-04-04 by the reprex package (v0.3.0)