@@ -359,7 +359,7 @@ predict_mod <- function(param, type, FM_change = NA,
359
359
list_Es <- vector(" list" , length(Lc ))
360
360
361
361
# show progress bar only if the loop has more than 1 runs
362
- if (! hide.progressbar ) {
362
+ if (! hide.progressbar && interactive() ) {
363
363
nlk <- length(Lc )
364
364
if (nlk > 1 ){
365
365
pb <- txtProgressBar(min = 1 , max = nlk , style = 3 )
@@ -501,7 +501,7 @@ predict_mod <- function(param, type, FM_change = NA,
501
501
list_Es [[i ]] <- df_loop_Es
502
502
503
503
# update counter and progress bar
504
- if (! hide.progressbar ) {
504
+ if (! hide.progressbar && interactive() ) {
505
505
if (nlk > 1 ){
506
506
setTxtProgressBar(pb , counter )
507
507
counter <- counter + 1
@@ -920,7 +920,7 @@ predict_mod <- function(param, type, FM_change = NA,
920
920
pred.FM_Lc_com_res_loopSSB_list <- vector(" list" ,length(FM_Lc_com_mat.list ))
921
921
pred.FM_Lc_com_res_loopSPR_list <- vector(" list" ,length(FM_Lc_com_mat.list ))
922
922
923
- if (! hide.progressbar ) {
923
+ if (! hide.progressbar && interactive() ) {
924
924
nlk <- prod(length(FM_Lc_com_mat.list ),dim(FM_Lc_com_mat.list [[1 ]])[2 ])
925
925
pb <- txtProgressBar(min = 1 , max = nlk , style = 3 )
926
926
counter <- 1
@@ -939,7 +939,7 @@ predict_mod <- function(param, type, FM_change = NA,
939
939
pred.FM_Lc_com_res_loop1_list [[x22 ]] <- res2 $ totals
940
940
941
941
# update counter and progress bar
942
- if (! hide.progressbar ) {
942
+ if (! hide.progressbar && interactive() ) {
943
943
setTxtProgressBar(pb , counter )
944
944
counter <- counter + 1
945
945
}
0 commit comments