In physical cosmology, the Big Rip is a hypothetical cosmological model concerning the ultimate fate of the universe, in which the matter of the universe, from stars and galaxies to atoms and subatomic particles, and even spacetime itself, is progressively torn apart by the expansion of the universe at a certain time in the future.

The goal of timerip is to be a fast extractor of individual date-time components, such as year or month, from Date or POSIXct objects.

Installation

You can install the dev version from GitHub with:

C API

There is also a C API that mirrors the R API exactly. To use it, there are a few steps.

First, add timerip to both Imports and LinkingTo in your Description file:

Next, add an .onLoad() R function for your package with the following in it, we’ll assume your package is named “mypackage”.

This ensures that the timerip namespace is available so you have access to the C callables that are exported from it, and then calls a package initialization function that is going to initialize the timerip C callables by calling timerip_init_api(). We haven’t created that function yet, let’s do it now.

Add a mypackage-timerip.c file with the following:

In your init.c file, add an entry for mypackage_init_timerip(). It should look something like this:

If you use roxygen2, you’ll also need to have a roxygen comment in an R file that looks like this (if you don’t already).

Now when you run devtools::document() and then devtools::load_all() everything should load without issues.

At this point, you can access the timerip API by including <timerip.h> in your C file: