Corregido el error en el que no había pacientes nuevos en la función sqlGenOVID.
This commit is contained in:
@@ -74,6 +74,7 @@ sqlGenOVID<-function(conn=dta, nhcs=nhc.test, verb=T, sinc=F, dbtype=NULL){
|
||||
dbid<-sqlFetch(conn,db["dbcode"])
|
||||
|
||||
new.nhc<-nhcs[!nhcs %in% dbid$NHC]
|
||||
if(length(new.nhc) > 0){
|
||||
next.num<-gsub(db["dbcode"],"",dbid[,db["dbcode"]]) %>% as.numeric %>% max(na.rm=T)+1
|
||||
last.num<-next.num+(length(new.nhc)-1)
|
||||
newtab<-data.frame("NHC"=new.nhc, "ID"=sprintf("%s%04d",db["dbcode"],next.num:last.num)) %>% rename(!!db["dbcode"]:="ID")
|
||||
@@ -96,6 +97,9 @@ sqlGenOVID<-function(conn=dta, nhcs=nhc.test, verb=T, sinc=F, dbtype=NULL){
|
||||
if (verb){
|
||||
return(dbid)
|
||||
}
|
||||
}else{
|
||||
print("No hay pacientes nuevos.")
|
||||
}
|
||||
}
|
||||
|
||||
sqlWriteTemp<-function(conn=dta, nhcs=nhc.test, file="queryOV.xlsx", samples.mod=T, clinics.mod=T, dbtype=NULL){
|
||||
|
||||
Reference in New Issue
Block a user