Learn R Programming

lares (version 4.8.4)

tic: Stopwatch to measure R Timings

Description

Start a stopwatch.

Stop a stopwatch.

Reset all tic and toc values in your environment.

Usage

tic(id = 1, quiet = TRUE)

toc(id = 1, msg = "Elapsed time:", units = TRUE, signif = 3, quiet = FALSE)

resettictoc(which = "both")

Arguments

id

Define ID if multiple tic() & toc() are being used

quiet

Boolean. Quiet messages?

msg

Character. Custom message shown

units

Boolean. Do you want nice format for the time units? If not, seconds elapsed as numerical values

signif

Integer. Significant digits

which

Character. Select: both, tic, toc

Value

toc returns an (invisible) list containing the timestamps tic and toc, time in seconds and the message msg.

See Also

Other Tools: autoline(), bindfiles(), bring_api(), db_download(), db_upload(), export_plot(), export_results(), get_credentials(), h2o_predict_API(), h2o_predict_MOJO(), h2o_predict_binary(), h2o_predict_model(), h2o_selectmodel(), h2o_update(), haveInternet(), image_metadata(), importxlsx(), ip_country(), iter_seeds(), json2vector(), listfiles(), mailSend(), msplit(), myip(), pass(), quiet(), read.file(), statusbar(), try_require(), updateLares(), zerovar()

Examples

Run this code
# NOT RUN {
# Basic use (global stopwatch)
tic()
Sys.sleep(0.1)
toc()

# Multiple tic tocs
tic(id = "two", quiet = FALSE)
Sys.sleep(0.2)
toc(id = "two")

# Global is still working (id = 1)
toc(msg = "The function finished its work in")
# }

Run the code above in your browser using DataLab