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 |
'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.
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++'
Dirk Eddelbuettel <[email protected]>
Dirk Eddelbuettel [aut, cre] (<https://orcid.org/0000-0001-6419-907X>)
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.
Int64toInt64(vec)
Int64toInt64(vec)
vec |
An |
A modified integer64
vector where each element
increased by one
# 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) }
# 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) }
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.
NanotimeToNanotime(vec)
NanotimeToNanotime(vec)
vec |
A |
A modified nanotime
vector where each element
increased by one
# 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) }
# 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) }