[Stacomir-commits] r550 - pkg/stacomir/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 22 18:11:22 CEST 2019
Author: briand
Date: 2019-10-22 18:11:21 +0200 (Tue, 22 Oct 2019)
New Revision: 550
Modified:
pkg/stacomir/R/report_mig_interannual.R
Log:
fixed bug for bilanmigrationinterannual when there are no data.
Modified: pkg/stacomir/R/report_mig_interannual.R
===================================================================
--- pkg/stacomir/R/report_mig_interannual.R 2019-04-06 05:56:57 UTC (rev 549)
+++ pkg/stacomir/R/report_mig_interannual.R 2019-10-22 16:11:21 UTC (rev 550)
@@ -101,6 +101,10 @@
data<- stacomirtools::killfactor(requete at query)
}
object at data<-fn_connect()
+ if (nrow(object at data)==0) {
+ funout(gettextf("No data in table t_bilanmigrationjournalier_bjo",domain="R-StacomiR"))
+ check=TRUE
+ }
#browser()
if (check){
#----------------------------------------------------------------------
@@ -120,12 +124,14 @@
# in the t_reportjournalier_bjo table
###########################################
#==========================================
- fn_check<-function(){
+
+ fn_check<-function(){
data1<-report_annual at data[report_annual at data$ope_dic_identifiant==dic[i],c("effectif","annee")]
# data from report_migInterannuel
data2<-object at data[object at data$bjo_dis_identifiant==dic[i],]
data21<-dplyr::select(data2,bjo_annee,bjo_valeur,bjo_labelquantite)
data22<-dplyr::group_by(data21,bjo_annee,bjo_labelquantite)
+ if (nrow(data22)==0) data22$bjo_valeur <- as.numeric(data22$bjo_valeur)
data23<-dplyr::summarize(data22,total=sum(bjo_valeur))
data24<-dplyr::filter(dplyr::ungroup(data23),bjo_labelquantite=="Effectif_total")
data24<-dplyr::select(data24,bjo_annee,total)
More information about the Stacomir-commits
mailing list