timer | R Documentation |
Useful mainly in a script file
to time, then log, each step (or process
)
in the file.
timer(
process,
notes = NULL,
file = NULL,
name = NULL,
log = NULL,
time_df = NULL,
write_log = grepl("end", process)
)
process |
Character. Name of the process being timed. |
notes |
Character. Any notes associated with the process. |
file |
Character. Name of the (script) file. |
name |
Character. Might be the same as |
log |
Character. Path to write the log file. |
time_df |
Object name or null for the initiation of a timer. |
write_log |
Write the log after this process. Default is only where process contains 'end'. |
Timer can be re-started by including 'start' in a process.
A dataframe (time_df), possibly with an additional row for the
current process. If write_log
then log
file is written.
time_df <- timer("start script", file = "file 01", name = "example", log = "example.log")
Sys.sleep(1)
time_df <- timer("process 01", time_df = time_df)
Sys.sleep(1)
time_df
time_df <- timer("end script", time_df = time_df) # log.log written
Sys.sleep(1)
time_df <- timer("start script", file = "file 02", time_df = time_df)
Sys.sleep(1)
time_df <- timer("process 01", time_df = time_df, write_log = TRUE) # log.log written
time_df <- timer("end script", time_df = time_df) # log.log written
# clean up
rm(time_df)
unlink("example.log")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.