Time arithmetic


# When in standard format, a string does not need a format spefication in order
# to be translatable
t0 <- as.POSIXct("2020-02-01 00:00",tz="GMT")
t0
[1] "2020-02-01 GMT"

# Adding 3600 seconds means adding an hour:
t0 + 3600
[1] "2020-02-01 01:00:00 GMT"

# Subtracting seconds may also change the date:
t0 - 1
[1] "2020-01-31 23:59:59 GMT"

# A day is 24 times 3600 seconds
day <- 24*3600
t0 + day
[1] "2020-02-02 GMT"

Downloadable R script and interactive version

Explanation

The link with the “jupyterhub” icon directs you to an interactive Jupyter1 notebook, which runs inside a Docker container2. There are two variants of the interative notebook. One shuts down after 60 seconds and does not require a sign it. The other requires sign in using your ORCID3 credentials, yet shuts down only after 24 hours. (There is no guarantee that such a container persists that long, it may be shut down earlier for maintenance purposes.) After shutdown all data within the container will be reset, i.e. all files created by the user will be deleted.4

Above you see a rendered version of the Jupyter notebook.5

1

For more information about Jupyter see http://jupyter.org. The Jupyter notebooks make use of the IRKernel package.

2

For more information about Docker see https://docs.docker.com/. The container images were created with repo2docker, while containers are run with docker spawner.

3

ORCID is a free service for the authentication of researchers. It also allows to showcase publications and contributions to the academic community such as peer review.. See https://info.orcid.org/what-is-orcid/ for more information.

4

The Jupyter notebooks come with NO WARRANTY whatsoever. They are provided for educational and illustrative purposes only. Do not use them for production work.

5

The notebook is rendered with the help of the nbsphinx extension.