diff --git a/RellenarOVBD.R b/RellenarOVBD.R index 2d67b9d..0bfd210 100644 --- a/RellenarOVBD.R +++ b/RellenarOVBD.R @@ -11,7 +11,8 @@ library(openxlsx) source("sqlFunctions.R") ## Conexión a la base de datos -dta<-odbcConnectAccess2007(access.file = "C:/Users/47926492N/OneDrive - IDIBELL - Institut d'Investigació Biomèdica de Bellvitge/RATG-PIULATS/OVARIO.accdb", +source("ruta_database.R", encoding = "UTF-8") +dta<-odbcConnectAccess2007(access.file = file, pwd = .rs.askForPassword("Enter password:")) ## Importamos los NHC de las muestras nuevas @@ -39,7 +40,7 @@ next.num<-gsub("OVID","",ovid$OVID) %>% as.numeric %>% max(na.rm=T)+1 last.num<-next.num+(length(new.nhc)-1) upd.ovid<-rbind(ovid,data.frame("NHC"=new.nhc, "OVID"=sprintf("OVID%04d",next.num:last.num))) rownames(upd.ovid)<-as.character(1:nrow(upd.ovid)) -upd.ovid<-filter(upd.ovid, NHC %in% new.nhc) +upd.ovid<-filter(upd.ovid, NHC %in% new.nhc) %>% mutate(NHC=as.character(NHC)) ### !! Atención, esto cambia la base de datos: sqlSave(dta, upd.ovid, tablename="OVID", append = T) diff --git a/ruta_database.R b/ruta_database.R new file mode 100644 index 0000000..1ac81ca --- /dev/null +++ b/ruta_database.R @@ -0,0 +1 @@ +file<-"C:/Users/47926492N/OneDrive - IDIBELL - Institut d'Investigació Biomèdica de Bellvitge/RATG-PIULATS/OVARIO.accdb" \ No newline at end of file