Skip to contents

Subset fields when reading from DHIS2

Usage

dhis2_subset_fields(data, fields = c("dataElement", "period", "value"))

Arguments

data

the input data frame

fields

vector of fields to select from the data frame

Value

an object of type data.frame with the data that contains only the fields of interest.

Examples

if (FALSE) {
results <- dhis2_subset_fields(
  data = readepi(
    credentials_file = system.file("extdata", "test.ini",
                                     package = "readepi"),
    data_source      = "https://play.dhis2.org/demo",
    query_parameters = list(
        dataSet   = "pBOMPrpg1QX,BfMAe6Itzgt",
        orgUnit   = "DiszpKrYNg8",
        startDate = "2014",
        endDate   = "2023")
  )$data,
  fields             = c("dataElement", "period", "value")
)
}