From e09e2c634424a9ba833182d6a2c3db91c1053261 Mon Sep 17 00:00:00 2001 From: Costa <47926492N@ICO.SCS.local> Date: Thu, 21 Oct 2021 09:36:47 +0200 Subject: [PATCH] Separar ruta de la base de datos de script principal. --- RellenarOVBD.R | 5 +++-- ruta_database.R | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 ruta_database.R 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