Learn R Programming

tidyndr (version 0.2.1)

disaggregate: Summarize an indicator into finer details by the specified variable

Description

Counts the number of occurrence of an outcome based on the category of interest. It also provides "Totals" at the end of the columns or rows (or both) where appropriate.

Usage

disaggregate(data, by, ...)

Arguments

data

Data containing the indicator to be disaggregated.

by

The variable of interest to be used for the disaggregation. The options are any of: "sex", "current_age", "pregnancy_status", "art_duration", "months_dispensed" (of ARV), and "age_sex".

...

Other parameters to be passed based on the by supplied. These are: 1) the `level` of disaggregation, ("ip" or "country", "state", "lga" and "facility"). 2) `pivot_wide` TRUE or FALSE, used to determine how the tabular data should be presented. The default options are "state" for by and TRUE for pivot_wide. value is "state".

Value

disaggregated data

Examples

Run this code
# NOT RUN {
### Disaggregate "TX_NEW" clients into age categories for each state
new_clients <- tx_new(ndr_example, from = "2021-01-01")
disaggregate(new_clients, by = "current_age") # default value of level is "state"

### Disaggregate "TX_CURR" by gender for each facility
curr_clients <- tx_curr(ndr_example)
disaggregate(curr_clients, by = "sex", level = "facility")

# }

Run the code above in your browser using DataLab