Get mortality data from SIM
get_sim.RdRetrieves mortality data from PCDaS API.
Usage
get_sim(
agg,
agg_time = "year",
ano,
pcdas_token = NULL,
sexo = NULL,
idade_a = NULL,
idade_b = NULL,
cid_like = NULL,
cid_in = NULL,
more_filters = NULL,
fetch_size = 65000
)Arguments
- agg
character. Spatial aggregation level.
uf_resfor UF of residence.uf_ocorfor UF of occurrence.regsaude_resfor regiao de saude of residence.regsaude_ocorfor regiao de saude of occurence.regsaude_449_resfor regiao de saude (449 units) of residence.regsaude_449_ocorfor regiao de saude (449 units) of occurence.mun_resfor municipality of residence.mun_ocorfor municipality of ocurrence.- agg_time
character. Time aggregation level.
yearfor yearly data.monthfor monthly data.weekfor weekly data. Defaults toyear.- ano
vector. Year of death.
- pcdas_token
character. PCDaS API token. If not provided, the function will look for it on renvirom.
- sexo
character. Sex of the deceased.
Masculinofor males,Femininofor females andIgnoradofor unknown.- idade_a
numeric. Minimum age of the deceased, in years.
- idade_b
numeric. Maximum age of the deceased, in years.
- cid_like
character. CID-10 code of basic cause of death. Used with a
LIKEoperator.- cid_in
character vector. CID-10 codes of basic cause of death. Used with a
INoperator.- more_filters
character. Additional filters can be added by using this parameter, with a SQL query.
- fetch_size
character. Pagination size for API call.
Details
This function uses raw data from the Sistema de Informações de Mortalidade (SIM) available at the PCDaS API. A documentation about this data can be found at https://pcdas.icict.fiocruz.br/conjunto-de-dados/sistema-de-informacoes-de-mortalidade-sim/.
If idade_a is supplied, the query will filter records with age less or equal. If idade_b is supplied, the query will filter records with age more or equal. If both are supplied, the query will filter records in the interval, closed on both sides.
The cid_like value is used in the query with a LIKE operator.
Examples
# Some examples
get_sim(agg = "mun_res", ano = 2010)
#> Error in get_pcdas_token_renviron(): PCDaS token API not provided and not found on renviron. Please provide PCDaS API token.
get_sim(agg = "uf_ocor", ano = 2010)
#> Error in get_pcdas_token_renviron(): PCDaS token API not provided and not found on renviron. Please provide PCDaS API token.
get_sim(agg = "uf_res", ano = 2010, idade_a = 10, idade_b = 30)
#> Error in get_pcdas_token_renviron(): PCDaS token API not provided and not found on renviron. Please provide PCDaS API token.
get_sim(agg = "uf_res", ano = 2010, cid_like = "I")
#> Error in get_pcdas_token_renviron(): PCDaS token API not provided and not found on renviron. Please provide PCDaS API token.
get_sim(agg = "uf_res", ano = 2010, cid_in = c("I219", "B342", "R98"))
#> Error in get_pcdas_token_renviron(): PCDaS token API not provided and not found on renviron. Please provide PCDaS API token.
get_sim(agg = "uf_res", ano = 2010, cid_in = cid_seq("I01", "I10"))
#> Error in get_pcdas_token_renviron(): PCDaS token API not provided and not found on renviron. Please provide PCDaS API token.