## A simple package for timing your code.
timeR
package allows you to create a timer
object to easily time your codes. Meanwhile, all records are saved to a
data frame, so it’s easy to retrieve all the records for later use.
Timing codes is not difficult but can be very tedious. With
timeR
, you can save your energy on timing and put more
effort on your analysis. You can use timeR
to time training
time for machine learning models, record speed for requests when running
web-scraping scripts or other situations that you need to keep records
of time.
install.packages("timeR")
# or install from github
::install_github("yusuzech/timeR") devtools
library(timeR)
# Create a timer object,precision default to s(second)
<- createTimer()
my_timer
# start timing for an event
$start("event one")
my_timer
#start timing for another event
$start("event two")
my_timer
# stop timing for the events
$stop("event one")
my_timer$stop("event two", comment = "my comment") # comment is optional
my_timer
# retrieve the table for all recordings
getTimer(my_timer)
# or create a timer object and setting verbose to false and use other precision
# s(second), ms(millisecond), us(microsecond)
<- createTimer(verbose = F,precision = "ms")
my_timer2
# toggle on/off verbose
$toggleVerbose()
my_timer
# warnings will still be shown when verbose is turned off
$stop("event one")
my_timer
# get attributes of a selected event
$getEvent("event one")
my_timer$getStartTime("event two") my_timer