Minimal example of an
R package LinkingTo the
You don't really need to install this package since you're not going to use it for anything. The code can be obtained by cloning this repository.
git clone https://github.com/markvanderloo/linkstringdist
This package uses a function from the
C API, which is called
C code. A more interesting and
C++ based example can be found in
the refinr package.
A full API description can be found by typing
Don't forget to set
@useDynLib via Roxygen documentation. Alternatively set
useDynLib() manually in the
stringdist to the
Imports fied of the
DESCRIPTION file is not
enough. You also need to add an
@import stringdist Roxygen field or an
import(stringdist) entry manually in the
NAMESPACE file to ensure that
stringdist is loaded and the shared object files are available. Alternatively
@ImportFrom or the
NAMESPACE equivalent will work as well.
This package also registers its single
C routine for export. This is only
necessary to avoid a
NOTE when preparing a package for CRAN. I.E. the note
only pops up when checking the package with the
--as-cran flag. So it is not
necessary to add a file like
R_RegisterNativeRoutines.c for local
Code for this package was developed using VIM.