-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refocus vignette on solving linear regression and remove package use * Improve the package usage note
- Loading branch information
Showing
2 changed files
with
47 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: "Using RcppEnsmallen in Your Own R Package" | ||
author: James Joseph Balamuta | ||
abstract: | | ||
This vignette describes the best practices for using RcppEnsmallen in your | ||
own R package. | ||
output: rmarkdown::html_vignette | ||
vignette: > | ||
%\VignetteIndexEntry{Using RcppEnsmallen in Your Own R Package} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
# Overview | ||
|
||
RcppEnsmallen is best used within an _R_ package. | ||
The setup for `RcppEnsmallen`'s use mirrors that of other `Rcpp`-based projects. | ||
In particular, the `DESCRIPTION` file requires the `LinkingTo` field and | ||
two files inside the `src/` to establish the necessary compilation options. | ||
In the next two sections, we show the modifications. | ||
|
||
## DESCRIPTION file | ||
|
||
Open your R package's `DESCRIPTION` file. Ensure that the `LinkingTo` directive | ||
is present and contains: | ||
|
||
```bash | ||
LinkingTo: Rcpp, RcppArmadillo (>= 0.9.800.0.0), RcppEnsmallen (>= 0.2.20.0.1) | ||
``` | ||
|
||
## Makevars inside the src/ Directory | ||
|
||
Next, the `src/` directory must contain both a `Makevars` and `Makevars.win` | ||
file. Each file must have the same contents of: | ||
|
||
```bash | ||
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) | ||
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) | ||
``` | ||
|
||
The `Makevars.win` file provides the appropriate configuration for Windows | ||
while `Makevars` acts on Unix-alike systems like macOS, Linux, and Solaris. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters