Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Problem with the historical exchange rate of the JPY in R

I was downloading historical data using the priceR package with the historical_exchange_rates function, but I am experiencing problems with the Yen. I have downloaded 10 other currencies and no problem, but the Yen/USD exchange rate is wrong, and it is the same as the Euro/USD. Does anyone know how to solve it?
Thanks

Here the code




library(priceR)

startDate <- "2006-01-01"
endDate <- "2020-12-31"


LPY_USD <- historical_exchange_rates("LPY", to = "USD",
                                start_date = startDate, end_date = endDate)

EUR_USD <- historical_exchange_rates("EUR", to = "USD",
                                start_date = startDate, end_date = endDate)

Thank you very much, in the confusion of all the code I didn’t realise that the ISO name was wrong. Classic error of distraction. I’m almost ashamed to have asked this question.
But it should give an error so that you can understand

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I think the problem is a typo – LPY not JPY. If the from or to parameters are a string it does not recognise it seems to default to euro and US. I cannot be sure though as the documentation doesn’t state these defaults and the function provides no warnings or errors regarding the issue (which it really should).

For example, these both return the same values:

historical_exchange_rates(from="EUR", to="USD", start_date = "2006-01-01", end_date = "2006-01-05")
historical_exchange_rates(from="", to="", start_date = "2006-01-01", end_date = "2006-01-05")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading