ironholds / lucr Goto Github PK
View Code? Open in Web Editor NEWCurrency conversion and reformatting in R, including a connector to the Open Exchange Rates API
License: Other
Currency conversion and reformatting in R, including a connector to the Open Exchange Rates API
License: Other
I have tried and failed to load the lucr package using both install.packages("lucr"), and devtools::install_github("ironholds/lucr"). With install.packages("lucr") I tried to repos. I am using Windows 7 Professional, R version 3.5.1 (2018-07-02), and RStudio 1.0.143
My apologies if this is the wrong place to post. I googled and looked at stackoverflow.
install.packages produces this error: Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘lucr’
If I have one value that has only hundreds and not thousands, then to_currency works.
to_currency(804.32, currency_symbol = "$")
[1] "$804.32"
If I have more than one value and some have more than the thousands place and others have less than the thousands place, then all numbers are given the comma.
to_currency(toc, currency_symbol = "$")
# [1] "$ 10,093.00" "$ , 20.32" "$139,012.00" "$ ,804.32"
Can you add a check for each value to make sure that the comma is warranted?
Thank you.
when using from_currency with strings with a comma as decimal delimiter, the decimal part is dropped
value<-"$ 1 234,5"
lucr::from_currency(value, decimal_delim = ",")
[1] 1234
I think it would be better to keep NA as NA instead of 0 in from_currency
.
This seem rather strange to me... I think the example makes the issue clear.
x <- c(NA,NA,210,"$550")
y <- as.character(x)
from_currency(x)
[1] 4.243992e-313 4.243992e-313 2.100000e+02 5.500000e+02
from_currency(y)
[1] 0 0 210 550
identical(x,y)
[1] TRUE
Also running it several times gives different result!
> from_currency(x)
[1] 0 0 210 550
> from_currency(x)
[1] 550 550 210 550
Actually the latter seems to be the real issue!
The list_currencies function works fine but currency_convert (and other functions) throws the error below.
list=list_currencies("https://openexchangerates.org/api/latest.json?app_id=db370e9558ff4946b1f4ffd919f79a90", as.df=FALSE)
currency_convert(5, from = "USD", "AUD", "https://openexchangerates.org/api/latest.json?app_id=db370e9558ff4946b1f4ffd919f79a90")
Error in oer_query("latest.json", key, NULL, ...) :
Unauthorized (HTTP 401).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.