collectivemedia / tictoc

R package with extended timing functions tic/toc, as well as stack and list structures.
Apache License 2.0
56 stars 9 forks source link

Error in if (log) { : argument is not interpretable as logical #6

Open jkylearmstrongibx opened 6 years ago

jkylearmstrongibx commented 6 years ago

tictoc::tic("CONNECTION_1") tictoc::toc("CONNECTION_1") CONNECTION_1: 3.039 sec elapsed Error in if (log) { : argument is not interpretable as logical

zmbc commented 3 years ago

@jkylearmstrongibx There's almost no chance you're still wondering, but you don't supply a name to the toc function. It's just:

tictoc::tic("CONNECTION_1")
tictoc::toc()
jkylearmstrong commented 3 years ago

I have just resorted to using Sys.time() and setting manually.

My next question would be how does this work if you have multiple timers? How does toc know which timer to give you the time for?

zmbc commented 3 years ago

It's a stack. You can't have overlapping timers, but you can have nested timers.

tictoc::tic("CONNECTION_1")
tictoc::tic("CONNECTION_1 -- part 1")
tictoc::toc() # This ends part 1
tictoc::tic("CONNECTION_1 -- part 2")
tictoc::toc() # This ends part 2
tictoc::toc() # This ends the overall timer

Note that I am not the developer of tictoc, just someone who finds it useful :)

jkylearmstrong commented 3 years ago

I sorta figured that was the case. Thanks for your insights!