Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Package to handle DateTimes as integers (called simDateTimes) for the smooth handling insiede simulations

Notifications You must be signed in to change notification settings

ims-fhs/simtimer

Repository files navigation

simtimer

simtimer in a little R package designed to simplify (and speeding up) calculating time intervals in discrete event simulations.

Discrete event simulations is a simulation paradigm that is based on the evaluation of events taking place in a time-specific order. Therefore a discrete event simulation calculates many time intervals. simtimer handles dates and times as integers. This makes working with time intervals as easy (and as fast) as subtracting integers.

Installation

You can install simtimer from CRAN or github with:

install.packages("simtimer")
# install.packages("devtools")
devtools::install_github("ims-fhs/simtimer")

Example

Simtimer allows transformation between datetimes (POSIXt) and sim_datetimes (integer) with sim_datetime() and datetime().

origin_date <- as.POSIXct("2016年01月01日 00:00:00", tz = "UTC")
my_datetime <- as.POSIXct("2016年01月02日 01:01:01", tz = "UTC")
my_simdatetime <- as.sim_datetime(my_datetime, origin_date)
my_simdatetime
#> [1] 90061
as.datetime(my_simdatetime, origin_date)
#> [1] "2016-01-02 01:01:01 UTC"

Simtimer allows to manipulate sim_datetimes and extract parts of sim_datetimes with sim_time(), sim_wday() and sim_date().

sim_time(my_simdatetime)
#> [1] 3661
sim_wday(my_simdatetime, origin_date)
#> [1] "6"
sim_date(my_simdatetime)
#> [1] 1

About

Package to handle DateTimes as integers (called simDateTimes) for the smooth handling insiede simulations

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 100.0%

AltStyle によって変換されたページ (->オリジナル) /