Skip to content

Commit 1c48d6d

Browse files
committed
Ensure col_types are subset when columns are.
1 parent 65d98da commit 1c48d6d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ ByteCompile: true
2828
Encoding: UTF-8
2929
LazyData: true
3030
Roxygen: list(markdown = TRUE)
31-
RoxygenNote: 6.1.0
31+
RoxygenNote: 6.1.1
3232
VignetteBuilder: knitr

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ export(quandl_datatable)
55
export(quandl_datatable_meta)
66
export(quandl_key_set)
77
importFrom(magrittr,"%>%")
8+
importFrom(rlang,.data)

R/tables.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#' input can be longer than `.batch`, so you can't filter on e.g. both 1000
2525
#' tickers and 1000 dates.
2626
#'
27+
#' @importFrom rlang .data
28+
#'
2729
#' @export
2830
#'
2931
#' @examples
@@ -56,11 +58,16 @@ quandl_datatable <- function(code, ..., .batch = 50L) {
5658
stop("`.batch` must be a single integerish value")
5759
}
5860

61+
quandl_params <- list(...)
62+
5963
# get column types from metadata
6064
type_df <- quandl_datatable_meta(code)$columns
65+
if ("qopts.columns" %in% names(quandl_params)) {
66+
type_df <- dplyr::filter(type_df, .data$name %in% quandl_params$qopts.columns)
67+
}
6168

6269
# process batches
63-
csv <- batch_parameters(list(...), .batch) %>%
70+
csv <- batch_parameters(quandl_params, .batch) %>%
6471
purrr::map(fetch_all_results, path = paste0("datatables/", code)) %>% # make requests
6572
rlang::flatten() %>%
6673
purrr::map_chr(httr::content, as = "text", encoding = "UTF-8") %>% # extract text

0 commit comments

Comments
 (0)