Package 'RcppInt64'

Title: 'Rcpp'-Based Helper Functions to Pass 'Int64' and 'nanotime' Values Between 'R' and 'C++'
Description: 'Int64' values can be created and accessed via the 'bit64' package and its 'integer64' class which package the 'int64' representation cleverly into a 'double'. The 'nanotime' packages builds on this to support nanosecond-resolution timestamps. This packages helps conversions between 'R' and 'C++' via several helper functions provided via a single header file. A complete example client package is included as an illustration.
Authors: Dirk Eddelbuettel [aut, cre]
Maintainer: Dirk Eddelbuettel <[email protected]>
License: GPL (>= 2)
Version: 0.0.5
Built: 2024-08-28 04:49:58 UTC
Source: https://github.com/eddelbuettel/rcppint64

Help Index


'Rcpp'-Based Helper Functions to Pass 'Int64' and 'nanotime' Values Between 'R' and 'C++'

Description

'Int64' values can be created and accessed via the 'bit64' package and its 'integer64' class which package the 'int64' representation cleverly into a 'double'. The 'nanotime' packages builds on this to support nanosecond-resolution timestamps. This packages helps conversions between 'R' and 'C++' via several helper functions provided via a single header file. A complete example client package is included as an illustration.

Package Content

Index of help topics:

Int64toInt64            Integer64 to Integer64 round-trip demo
NanotimeToNanotime      nanotime to nanotime round-trip demo
RcppInt64-package       'Rcpp'-Based Helper Functions to Pass 'Int64'
                        and 'nanotime' Values Between 'R' and 'C++'

Maintainer

Dirk Eddelbuettel <[email protected]>

Author(s)

Dirk Eddelbuettel [aut, cre] (<https://orcid.org/0000-0001-6419-907X>)


Integer64 to Integer64 round-trip demo

Description

This function takes an integer64-valued input vector, converts it to the equivalent int64_t vector in C++, displays each element after first adding one, and returns the modified vector.

Usage

Int64toInt64(vec)

Arguments

vec

An integer64-classed vector from R

Value

A modified integer64 vector where each element increased by one

Examples

# generate all powers of 10 fro 0 .. 18
if (requireNamespace("bit64", quietly=TRUE)) {
    v <- bit64::as.integer64(10^seq(0,18))
    # pass them to function which will add one to each, print  and return
    Int64toInt64(v)
}

nanotime to nanotime round-trip demo

Description

This function takes an nanotime-valued input vector, converts it to the equivalent int64_t vector in C++, displays each element after first adding one, and returns the modified vector.

Usage

NanotimeToNanotime(vec)

Arguments

vec

A nanotime-classed vector from R

Value

A modified nanotime vector where each element increased by one

Examples

# generate all powers of 10 fro 0 .. 18
if (requireNamespace("nanotime", quietly=TRUE)) {
    v <- nanotime::as.nanotime(10^seq(0,18))
    # pass them to function which will add one to each, print  and return
    NanotimeToNanotime(v)
}