Skip to content

Commit

Permalink
Print ID of resources in bcdc_search; add readr to imports in DESCRIP…
Browse files Browse the repository at this point in the history
…TION
  • Loading branch information
ateucher committed Dec 21, 2018
1 parent 5944648 commit a2c00dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Imports:
httr (>= 1.4),
purrr (>= 0.2),
sf (>= 0.7),
readr (>= 1.3),
utils
Suggests:
knitr,
Expand Down
8 changes: 5 additions & 3 deletions R/bcdc_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,13 @@ print.bcdc_recordlist <- function(x) {
len <- length(x)
n_print <- min(10, len)
cat("\nNumber of records:", len)
if (n_print < len) cat(" (Showing the top 10.)")
if (n_print < len) cat(" (Showing the top 10)")
cat("\nTitles:\n")
x <- purrr::set_names(x, NULL)
cat(paste(purrr::imap(x[1:n_print], ~ {
paste0(.y, ": ", .x[["title"]])
paste0(.y, ": ", .x[["title"]], "\n ID: ",
.x[["id"]])
}), collapse = "\n"), "\n")
cat("\nAccess a single record by indexing the record list by its number")
cat("\nAccess a single record by calling bcdc_get_record(ID)
with the ID from the desired record.")
}

0 comments on commit a2c00dc

Please sign in to comment.