From a740e3144df2420a246c89d28e984e56c9e7ead2 Mon Sep 17 00:00:00 2001 From: Jon Cole Date: Tue, 25 Sep 2018 21:48:02 -0700 Subject: [PATCH] Add realtime currency exchange call. includes commented section for review if simplified output is preferable --- R/av_get.R | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/R/av_get.R b/R/av_get.R index ce78d72..47f4a2f 100644 --- a/R/av_get.R +++ b/R/av_get.R @@ -83,6 +83,17 @@ av_get <- function(symbol = NULL, av_fun, ...) { } + + } + # Realtime Currency Exchange Rate + if (content_list[1] %>% names() == "Realtime Currency Exchange Rate") { + content <- content_list %>% tibble::enframe() %>% + dplyr::mutate(val = purrr::map(value, tibble::enframe)) %>% + tidyr::unnest(val, .drop = T) %>% + tidyr::spread(key = name1, value = value) # %>% + # tidyr::unite(`Currency Exchange`, `2. From_Currency Name`, `4. To_Currency Name`, sep = " to ") %>% + # tidyr::unite(Symbol, `1. From_Currency Code`, `3. To_Currency Code`, sep = "/") %>% + # dplyr::select(Name = name, `Currency Exchange`, Symbol, `Exchange Rate` = `5. Exchange Rate`, `Last Refreshed` = `6. Last Refreshed`) } else { # Bad Call