R/govcan_search.R
govcan_search.Rd
This function wraps ckanr::package_search()
to search for any
records matching a given set of keywords within the Open Canada Portal.
govcan_search(
keywords,
records = 10,
only_results = TRUE,
format_results = FALSE,
...
)
(character vector) A set of keywords to query.
(numeric) The number of matching records to return from the CKAN query (number of rows in the JSON output), default to 10.
(logical) Whether the function should return only the
results without the query metadata (default is TRUE
).
(logical) Whether the function should return a
formatted output of the results as a tibble
or an unformatted version under
the form of a list of CKAN packages (default is FALSE
).
More arguments to be passed on to ckanr::package_search()
.
If only_results
is TRUE
and format_results
is FALSE
(recommended), will return only the results of the search as a
CKAN_package_stack
. If only_results
is FALSE
, will return a list
including also the query metadata. If format_results
is TRUE
, the
function formats the output as a data frame (not CKAN packages).
if (FALSE) {
search <- govcan_search("dfo", 10)
search_format <- govcan_search("dfo", 10, format_results = TRUE)
search_list <- govcan_search("dfo", 10, only_results = FALSE)
search_list_format <- govcan_search("dfo", 10, format_results = TRUE,
only_results = FALSE)
}