################################################################################################## #
## Extraire les fichiers du dossier compressé V:\GI-Data\_Variation_hospit\BD\APRDRG_2006_2016.zip
## avant de lancer ce script.
################################################################################################## #
library(data.table)
library(memisc)
an.analyse <- 2006:2016
for(yr in an.analyse){
# Importation BD
DT <- as.data.set(spss.system.file(paste0(
"V:/GI-Data/_Variation_hospit/BD/APRDRG_2006_2016/APRDRG_",yr,substr(yr+1,3,4),".sav"
)))
DT <- Iconv(DT, "UTF-8", "latin1") # convertir encoding
attach(DT)
# Création BD d'analyse
dt <- data.table(
ANNEE = as.numeric(annee),
ID = as.character(nobanal),
AGE = as.integer(age),
SEXE = as.character(sexe),
DRG = as.numeric(drg24),
DRG_DESC = as.character(drg24),
RLS = as.numeric(as.character(rlsben)),
MEDCHIR = as.numeric(medchir),
MEDCHIR_DESC = as.character(medchir),
DRG_CH1J = as.numeric(drg_ch1j),
DRG_CH1J_DESC = as.character(drg_ch1j),
DAT_ADM = as.character(datadm),
DAT_SORT = as.character(datsort)
); detach(DT)
# BD commune de toutes les années
if(yr == an.analyse[[1]]){
aprdrg <- dt
} else {
aprdrg <- rbind(aprdrg, dt)
}
}
# Arrangement
aprdrg <- aprdrg[SEXE != "X"]
aprdrg <- aprdrg[!RLS %in% c(0, 1001, 1701, 1801)]
aprdrg[, DRG_DESC := gsub(" l'oil ", " l'oeil ", DRG_DESC)]
aprdrg[, DRG_DESC := gsub("l'osophage", "l'oesophage", DRG_DESC)]
aprdrg[, DRG_DESC := gsub(" cour ", " coeur ", DRG_DESC)]
saveRDS(aprdrg, paste0(
"V:/GI-Data/_Variation_hospit/BD/aprdrg_",an.analyse[[1]],"_",an.analyse[[length(an.analyse)]],".rds"
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.