Skip to content

Commit baa58b4

Browse files
committed
Clarified argument name
1 parent a2e5361 commit baa58b4

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

R/fetch_data.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
#' Retrieve DHS API data
22
#'
3-
#' \code{fetch_data} retrieves DHS API data and returns a dataframe with arguments to specify countries, years, indicators, tags, and level of disaggregation.
3+
#' \code{fetch_data} retrieves DHS API data and returns a dataframe with arguments to specify countries, years, indicators, tag, and level of disaggregation.
44
#' @details Set DHS API key with \code{\link{set_api_key}} and return fields with \code{\link{set_return_fields}}.
55
#' @param countries Specify countries by DHS country code. Use \code{fetch_countries} for listing of DHS country codes.
66
#' @param years Specify survey year(s)
77
#' @param indicators Specify indicators by indicator_id. Use \code{fetch_indicators} for indicator details including indicator_ids.
8-
#' @param tags Specify tag. Use \code{fetch_tags} for details. NOTE: only 1 tag can be specified per call.
8+
#' @param tag Specify tag. Use \code{fetch_tags} for details. NOTE: only 1 tag can be specified per call.
99
#' @param breakdown_level Specify level of data disaggregation. Options include "national" (default), "subnational", "background", and "all".
1010
#' @param add_geometry Set to "true" for inclusion of polygon coordinates.
1111
#' @return A list containing the API call and dataframe of the results.
1212
#' @seealso \code{\link{fetch_countries}}, \code{\link{fetch_indicators}}, \code{\link{fetch_tags}}
1313
#' @examples
1414
#' # Return all immunization tagged data for Ghana and Kenya from 2010 to 2016
15-
#' fetch_data(countries = c("GH", "KE"), years = 2010:2016, tags = 32, breakdown_level = "all")
15+
#' fetch_data(countries = c("GH", "KE"), years = 2010:2016, tag = 32, breakdown_level = "all")
1616
#'
1717
#' # Return all national-level data for "Assistance during delivery from a skilled provider" and
1818
#' "Treatment of diarrhea: Taken to a health facility"
1919
#' fetch_data(indicators = c("RH_DELA_C_SKP", "CH_DIAT_C_ADV"), breakdown_level = "national")
2020
#'
2121
#' # Return all 2016 data with geometry for the tag "SDGs"
22-
#' fetch_data(years = 2016, tags = 80, add_geometry = "true")
22+
#' fetch_data(years = 2016, tag = 80, add_geometry = "true")
2323
#' @importFrom magrittr %>%
2424
#' @importFrom magrittr %<>%
2525
#' @export
26-
fetch_data <- function(countries = NULL, years = NULL, indicators = NULL, tags = NULL, breakdown_level = NULL, add_geometry = NULL) {
26+
fetch_data <- function(countries = NULL, years = NULL, indicators = NULL, tag = NULL, breakdown_level = NULL, add_geometry = NULL) {
2727

2828
# check args
29-
attempt::stop_if_all(c(countries, years, indicators, tags, breakdown_level), is.null, "Please specify at least one argument")
30-
attempt::stop_if(tags, ~ length(.x) > 1, "Only one tag may be specified per call")
29+
attempt::stop_if_all(c(countries, years, indicators, tag, breakdown_level), is.null, "Please specify at least one argument")
30+
attempt::stop_if(tag, ~ length(.x) > 1, "Only one tag may be specified per call")
3131

3232
# collapse args with multiple inputs
3333
countries <- stringr::str_c(countries, collapse = ",")
3434
years <- stringr::str_c(years, collapse = ",")
3535
indicators <- stringr::str_c(indicators, collapse = ",")
36-
tags <- stringr::str_c(tags, collapse = ",")
36+
tag <- stringr::str_c(tag, collapse = ",")
3737

3838
# optional args
3939
returnFields <- dplyr::if_else(is.null(getOption("return_fields")), "", getOption("return_fields")) # from set_return_fields()
@@ -46,7 +46,7 @@ fetch_data <- function(countries = NULL, years = NULL, indicators = NULL, tags =
4646
countryIds = countries,
4747
surveyYear = years,
4848
indicatorIds = indicators,
49-
tagIds = tags,
49+
tagIds = tag,
5050
breakdown = breakdown_level,
5151
returnGeometry = add_geometry,
5252
returnFields = returnFields,

man/fetch_data.Rd

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)