The goal of smgenerics
is to extend the
generics package for less known
methods that are part of various statistical models. The motivation is
exactly the same with generics
, i.e. to reduce dependencies by
providing a set of generic methods that can be imported.
And the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("kvasilopoulos/smgenerics")
A very characteristic example is the packages that are using Vector
Autoregressive modelling like vars
and svars
. These packages require
the the use of irf
(Impulse Response Funcion) and hd
(Historical
Decomposition) generics to function.
library(smgenerics)
irf
#> function(x, ...) {
#> UseMethod("irf")
#> }
#> <bytecode: 0x0000000018681040>
#> <environment: namespace:smgenerics>
fevd
#> function(x, ...) {
#> UseMethod("fevd")
#> }
#> <bytecode: 0x0000000017c6b228>
#> <environment: namespace:smgenerics>
To use smgenerics
with your package, import and re-export the generic.
#' @importFrom smgenerics irf
#' @export
smgenerics::irf
Please note that the ‘smgenerics’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms. [Copied to clipboard]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.