@@ -384,8 +384,9 @@ as.data.frame.neuronlist<-function(x, row.names = names(x), optional = FALSE, ..
384384# ' Progress bar section for details) The default value of \code{"auto"} shows
385385# ' a progress bar in interactive use after 2s. The default value can be
386386# ' overridden for the current session by setting the value of
387- # ' \code{options(nat.progressbar)} (see examples).
388- # '
387+ # ' \code{options(nat.progressbar)} (see examples). Values of \code{T} and
388+ # ' \code{F} are aliases for 'text' and 'none', respectively.
389+ # '
389390# ' @section Progress bar: There are currently two supported approaches to
390391# ' defining progress bars for \code{nlapply}. The default (when
391392# ' \code{progress="auto"}) now uses a progress bar built using
@@ -472,11 +473,16 @@ as.data.frame.neuronlist<-function(x, row.names = names(x), optional = FALSE, ..
472473# ' }
473474nlapply <- function (X , FUN , ... , subset = NULL , OmitFailures = NA ,
474475 .progress = getOption(' nat.progress' , default = ' auto' )){
475- if (.progress == ' auto' ) {
476+ if (isTRUE( .progress == ' auto' ) ) {
476477 .progress = ifelse(interactive(), " natprogress" , " none" )
477- } else if (.progress == ' traditional' ) {
478+ } else if (isTRUE( .progress == ' traditional' ) ) {
478479 .progress = ifelse(length(X )> = 10 && interactive(), " text" , " none" )
479- }
480+ } else if (isTRUE(.progress )) {
481+ .progress <- ' text'
482+ } else if (isFALSE(.progress )) {
483+ .progress <- ' none'
484+ }
485+ checkmate :: assert_character(.progress , any.missing = F , len = 1L )
480486 cl = if (is.neuronlist(X ) && ! inherits(X , c(' neuronlistfh' ,' neuronlistz' )))
481487 class(X )
482488 else c(" neuronlist" , ' list' )
@@ -547,7 +553,14 @@ nmapply<-function(FUN, X, ..., MoreArgs = NULL, SIMPLIFY = FALSE,
547553 }
548554 FUN2 = FUN
549555
550- if (.progress == ' auto' ) .progress = ifelse(interactive(), ' text' , ' none' )
556+ if (isTRUE(.progress == ' auto' )) {
557+ .progress = ifelse(interactive(), " text" , " none" )
558+ } else if (isTRUE(.progress )) {
559+ .progress <- ' text'
560+ } else if (isFALSE(.progress )) {
561+ .progress <- ' none'
562+ }
563+ checkmate :: assert_character(.progress , any.missing = F , len = 1L )
551564
552565 if (.progress != ' none' ){
553566 p <- progress_natprogress()
0 commit comments