load_datasus.RdLoads DATASUS data on health establishments, mortality, access to health services and several health indicators.
load_datasus(
dataset,
time_period,
states = "all",
raw_data = FALSE,
keep_all = FALSE,
language = "eng"
)A dataset name, can be one of ("datasus_sim_do", "datasus_sih", "datasus_cnes_lt"), or more. For more details, try vignette("DATASUS").
A numeric indicating for which years the data will be loaded, in the format YYYY. Can be any vector of numbers, such as 2010:2012.
A string specifying for which states to download the data. It is "all" by default, but can be a single state such as "AC" or any vector such as c("AC", "AM").
A boolean setting the return of raw (TRUE) or processed (FALSE) data.
A boolean choosing whether to aggregate the data by municipality, in turn losing individual-level variables (FALSE) or to keep all the original variables. Only applies when raw_data is TRUE.
A string that indicates in which language the data will be returned. Portuguese ("pt") and English ("eng") are supported.
A tibble.
if (FALSE) {
# download raw data for the year 2010 in the state of AM.
data <- load_datasus(
dataset = "datasus_sim_do",
time_period = 2010,
states = "AM",
raw_data = TRUE
)
# download treated data with the number of deaths by cause in AM and PA.
data <- load_datasus(
dataset = "datasus_sim_do",
time_period = 2010,
states = c("AM", "PA"),
raw_data = FALSE
)
# download treated data with the number of deaths by cause in AM and PA
# keeping all individual variables.
data <- load_datasus(
dataset = "datasus_sim_do",
time_period = 2010,
states = c("AM", "PA"),
raw_data = FALSE,
keep_all = TRUE
)
}