Remove duplicated country-year rows in UNICEF datasets, based on a specified priority order.

filter_unicef(df, priority)

Arguments

df

data.frame: A pddcs formatted data frame. Output of fetch_indicator().

priority

character: A vector with survey sources to prioritize between. See details.

Value

data.frame

Details

The abbreviation of survey sources in the note column is used to prioritize between different surveys if there are duplicated country-years. Typical use cases are MIS, DHS, MICS and AIS. The surveys are prioritized in the order they are listed, e.g. if priority = c('X', 'Y', 'Z'), then X will be chosen before Y, which again will be chosen before Z.