Time Your Codes

Provides a 'timeR' class that makes timing codes easier. One can create 'timeR' objects and use them to record all timings, and extract recordings as data frame for later use.

Travis build status

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.

How to install

# current this package is not on CRAN, please install from github

Basic Usage

# Create a timer object
my_timer <- createTimer()
# start timing for an event
my_timer$start("event one")
#start timing for another event
my_timer$start("event two")
# stop timing for the events
my_timer$stop("event one")
my_timer$stop("event two", comment = "my comment") # comment is optional
# retrieve the table for all recordings
# or create a timer object and setting verbose to false
my_timer2 <- createTimer(verbose = F)
# toggle on/off verbose
# warnings will still be shown when verbose is turned off
my_timer$stop("event one")


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.2.0 by Yifu Yan, 2 years ago


Report a bug at https://github.com/yusuzech/timeR/issues

Browse source code at https://github.com/cran/timeR

Authors: Yifu Yan

Documentation:   PDF Manual  

Apache License (== 2.0) | file LICENSE license

Imports R6, lubridate

Suggests knitr, rmarkdown, testthat

See at CRAN