R is an amazing language to explore and communicate statistics with. However, when we care about attain results quickly, R’s primary weakness is shown: speed. The objective of this repository is to strengthen this weakness by providing high performing R base functions within Armadillo (and potentially eigen). Futhermore, as the code is written within C++, the code is able to be ported to different platforms at ease. Lastly, an additional benefit of this project is a repository containing programming examples by field.
Feel free to use the functions available within the repository per the MIT License.
Project Details
The functions written here act either as a means to replicate existing R functionality within Armadillo or as a helpful interface to Armadillo’s objects to perform crazier operations. These functions are meant to be easily included within existing code bases with minimal dependencies. In its packaged form, the project uses the R to C++ interface afforded by RcppArmadillo
Note: At some point in the future, these functions may end up being merged into the RcppArmadillo
project.
The current implementation has:
-
Distributions
- Random Sampling
- Wishart
- Inverse Wishart
- Random Sampling
-
Time Series
- Difference by lag and number of differences
- Discrete Integration by lag, number of differences, and - optionally - initial values.
- Convert ARMA process to an infinite MA process
- Compute the theoretical autocorrelation function (ACF) for an ARMA process.
- Convolution (Moving Average) or Recursive (Autoregression) filters.
- Calculate Discrete Fourier Transformation (DFT) for Autocovariance Function (ACF)
-
Sequences
- Generate Integer Sequence from
a
tob
- Generate Double Sequence form
a
tob
or-a
toa
withn
points. - Obtain a sequence along a vector.
- Obtain a sequence given a vector length.
- Generate Integer Sequence from
-
Manipulations
- Vector
- Reverse vector (e.g.
1:3
=>3:1
)
- Reverse vector (e.g.
- Matrix
- Reverse subset for row/column (e.g.
0:3
vs.3:0
) - Subset Non-connected Regions (e.g.
c(0,1)
andc(2,1)
)
- Reverse subset for row/column (e.g.
- Field
- Convert
field<vec>
tomat
- Total sum of elements in
field
- Convert
- Vector
Contributing
Contributions such as translations of R functions to C++ are welcome via a pull request. If you have a new feature request, please feel free to write an issue.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.