Description Usage Arguments Value Examples
This function returns the time needed for a function to run in milliseconds, and prints it.
1 2 3 | timer_func_print(expr, seconds = FALSE, pre_msg = "The function ran in ",
msg_format = "%05.03f", post_msg = ifelse(seconds == TRUE, " seconds.",
" milliseconds."), linebreak = TRUE)
|
expr |
Type: any expression. An expression to evalutate (the expression you want to benchmark). |
seconds |
Type: logical. Whether you want milliseconds (default) or seconds. Defaults to |
pre_msg |
Type: character. The message preceeding the time print. Defaults to |
msg_format |
Type: character. The formatting applied to the evaluation time, used by |
post_msg |
Type: character. The message succeeding the time print. Defaults to |
linebreak |
Type: logical. Whether to add a line break after the printed message. Defaults to |
The time needed for a function to run in milliseconds (or seconds).
1 2 | library(R.utils)
timer_func_print({for (i in 1:100) {rnorm(1)}}, seconds = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.