Skip to content

Commit

Permalink
no need for row number printing when only one condition supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Oct 23, 2024
1 parent a52c720 commit 67c513d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: SimDesign
Title: Structure for Organizing Monte Carlo Simulation Designs
Version: 2.17.1
Version: 2.17.2
Authors@R: c(person("Phil", "Chalmers", email = "rphilip.chalmers@gmail.com", role = c("aut", "cre"),
comment = c(ORCID="0000-0001-5332-2810")),
person("Matthew", "Sigal", role = c("ctb")),
Expand Down
6 changes: 3 additions & 3 deletions R/SimSolve.R
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,11 @@ SimSolve <- function(design, interval, b, generate, analyse, summarise,
' using integer=TRUE search'), call.=FALSE)
}
for(i in start:nrow(design)){
if(verbose){
cat(sprintf('\n\n#############\nDesign row %s:\n\n', i))
if(verbose && nrow(design) > 1L){
cat(sprintf('\n#############\nDesign row %s:\n\n', i))
print(cbind(as.data.frame(design[i,]), b = b))
cat("\n")
}
if(verbose) cat("\n")

.SIMDENV$stored_results <- vector('list', maxiter)
.SIMDENV$stored_medhistory <- rep(NA, maxiter)
Expand Down
10 changes: 7 additions & 3 deletions R/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ print_progress <- function(row, trow, stored_time, RAM, progress,
condstring <- paste0(nms, '=', nms2, collapse=', ')
}
}
if(RAM != "") RAM <- sprintf('; RAM Used: %s', RAM)
cat(sprintf('\rDesign: %i/%i%s; Replications: %i; Total Time: %s ',
row, trow, RAM, replications, timeFormater_internal(sum(stored_time))))
if(RAM != "") RAM <- sprintf('; RAM Used: %s;', RAM)
if(row == 1 && trow == 1)
cat(sprintf('\rReplications: %i%s Total Time: %s ',
replications, RAM, timeFormater_internal(sum(stored_time))))
else
cat(sprintf('\rDesign: %i/%i; Replications: %i%s Total Time: %s ',
row, trow, replications, RAM, timeFormater_internal(sum(stored_time))))
cat(sprintf('\n Conditions: %s\n', condstring))
if(progress) cat('\r')
invisible(NULL)
Expand Down

0 comments on commit 67c513d

Please sign in to comment.