R package to read, parse and do basic manipulation of INE Morbidity microdata Morbilidad Hospitalaria Microdatos INE. The metadata of the microdata is documented here.
This packages uses international classification of diseases documented here
library(devtools)
install_github("rOpenSpain/MorbiditySpainR")
The function GetMorbiData
recives the years to read morbidity data, downloads the files from INE's ftp server and parses them.
data <- GetMorbiData(y1=2010,y2=2011)
head(data)
The function FilterProvincia
recives the id of the provincia (regional administration) to filter data.
data <- data <- data_ejemplo %>% FilterProvincia(28)
head(data)
The function FilterEmergency
recives a boolean (defect TRUE) to filter data by wether or not is an ER item.
data <- data_ejemplo %>% FilterEmergency()
head(data)
The function FilterDiagnosis
recives a integer (id of diagnosis) to filter data by principal diagnosis.
data <- data_ejemplo %>% FilterDiagnosis1(2)
head(data)
The function FilterDiagnosis2
recives a integer (id of diagnosis) to filter data by secondary diagnosis.
data <- data_ejemplo %>% FilterDiagnosis2(20)
head(data)
The function AddDiagnosis1
add column daig1 with principal diagnosis.
data <- data_ejemplo %>% AddDiagnosis1()
head(data)
The function AddDiagnosis2
add column daig2 with secondary diagnosis.
data <- data_ejemplo %>% AddDiagnosis2()
head(data)
The function AddDiagnosis3
add column daig3 with specific diagnosis.
data <- data_ejemplo %>% AddDiagnosis3()
head(data)
The function ReduceData
does different grouping manipulations by provincia, date, diagnosis or sex.
data <- data_ejemplo %>% ReduceData(provincia = TRUE,date = "day")
head(data)
The function SetPrevalence
gets relative values from grouped values and population (total or by sex) of provinces.
data <- data_ejemplo %>% ReduceData(provincia = TRUE,date="year") %>% SetPrevalence()
head(data)
NOTE: installing rJava and rlang in mac can be tricky I followed this