Skip to content

Commit 1e7ad2d

Browse files
committed
suppress printing of time if message is turned off
1 parent 39d262b commit 1e7ad2d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

R/sim_choice.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ sim_choice <- function(designfile, no_sim = 10, respondents = 330, u,
276276
data = sim_data[[.x]]
277277
)
278278
)
279-
tictoc::toc()
279+
message( capture.output(tictoc::toc(log = FALSE, quiet = TRUE)) )
280280

281281
chunkfilename <- paste0(dname, "_tmp_", i, ".qs")
282282

@@ -320,7 +320,7 @@ sim_choice <- function(designfile, no_sim = 10, respondents = 330, u,
320320
data = .x
321321
)
322322
)
323-
tictoc::toc()
323+
message( capture.output(tictoc::toc(log = FALSE, quiet = TRUE)) )
324324
}
325325

326326

R/simulate_choices.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ simulate_choices <- function(data, utility, setspp, bcoeff, decisiongroups = c(0
4949

5050
tictoc::tic("whole simulate choices")
5151

52-
tictoc::tic("assign keys for bcoeff)")
52+
tictoc::tic("assign keys for bcoeff")
5353
### unpack the bcoeff list so variables are accessible
5454
for (key in names(bcoeff)) {
5555
assign(key, bcoeff[[key]])
5656
}
5757

58-
tictoc::toc()
58+
message( capture.output(tictoc::toc(log = FALSE, quiet = TRUE)) )
5959

6060

6161
by_formula <- function(equation) { # used to take formulas as inputs in simulation utility function
@@ -98,7 +98,7 @@ simulate_choices <- function(data, utility, setspp, bcoeff, decisiongroups = c(0
9898
data <- data %>%
9999
dplyr::group_by(ID) %>%
100100
dplyr::mutate(!!!manipulations)
101-
tictoc::toc()
101+
message( capture.output(tictoc::toc(log = FALSE, quiet = TRUE)) )
102102

103103
# browser()
104104
#
@@ -112,7 +112,7 @@ simulate_choices <- function(data, utility, setspp, bcoeff, decisiongroups = c(0
112112
## split dataframe into groups
113113
subsets <- split(data, data$group)
114114

115-
tictoc::toc()
115+
message( capture.output(tictoc::toc(log = FALSE, quiet = TRUE)) )
116116

117117
tictoc::tic("for each group calculate utility")
118118
## for each group calculate utility
@@ -123,7 +123,7 @@ simulate_choices <- function(data, utility, setspp, bcoeff, decisiongroups = c(0
123123

124124
## put data from eachgroup together again
125125
data <- dplyr::bind_rows(subsets)
126-
tictoc::toc()
126+
message( capture.output(tictoc::toc(log = FALSE, quiet = TRUE)) )
127127

128128
tictoc::tic("add random component")
129129
## add random component and calculate total utility
@@ -139,9 +139,9 @@ simulate_choices <- function(data, utility, setspp, bcoeff, decisiongroups = c(0
139139
as.data.frame()
140140

141141

142-
tictoc::toc()
142+
message( capture.output(tictoc::toc(log = FALSE, quiet = TRUE)) )
143143

144-
tictoc::toc()
144+
message( capture.output(tictoc::toc(log = FALSE, quiet = TRUE)) )
145145

146146
message("\n data has been created \n")
147147

0 commit comments

Comments
 (0)