@@ -564,12 +564,12 @@ cleangrowth <- function(subjid,
564
564
565
565
# adult: send to cleanadult to do most of the work ----
566
566
567
- if (! quietly ){
568
- cat(sprintf(" [%s] Begin processing adult data...\n " , Sys.time()))
569
- }
570
-
571
567
# no need to do this if there's no data
572
568
if (nrow(data.adult ) > 0 ){
569
+ if (! quietly ){
570
+ cat(sprintf(" [%s] Begin processing adult data...\n " , Sys.time()))
571
+ }
572
+
573
573
# TODO: MAKE THIS BETTER -- FUNCTION OR SOMETHING
574
574
# TODO: BATCH LOGS??
575
575
# if parallel processing is desired, load additional modules
@@ -659,19 +659,23 @@ cleangrowth <- function(subjid,
659
659
}
660
660
661
661
662
- # join with pediatric data
663
- full_out <- data.table(
664
- line = c(ret.df $ line , res $ line ),
665
- exclude = c(as.character(ret.df $ exclude ), res $ result ),
666
- mean_sde = c(rep(NA , nrow(ret.df )), res $ mean_sde )
667
- )
668
- full_out [, exclude : = factor (exclude , levels = unique(c(exclude.levels ,
669
- unique(exclude ))))]
670
- full_out <- full_out [order(line ),]
671
- # remove column added for keeping track
672
- full_out [, line : = NULL ]
662
+ if (any(nrow(data.all ) > 0 , nrow(data.adult ) > 0 )) {
663
+ # join with pediatric data
664
+ full_out <- data.table(
665
+ line = c(ret.df $ line , res $ line ),
666
+ exclude = c(as.character(ret.df $ exclude ), res $ result ),
667
+ mean_sde = c(rep(NA , nrow(ret.df )), res $ mean_sde )
668
+ )
669
+ full_out [, exclude : = factor (exclude , levels = unique(c(exclude.levels ,
670
+ unique(exclude ))))]
671
+ full_out <- full_out [order(line ),]
672
+ # remove column added for keeping track
673
+ full_out [, line : = NULL ]
673
674
674
- return (full_out $ exclude )
675
+ return (full_out $ exclude )
676
+ } else {
677
+ return (c())
678
+ }
675
679
676
680
}
677
681
0 commit comments