library(ferx)
packageVersion("ferx")
#> [1] '0.3.0'Installing ferx
ferx is an R package with a compiled Rust engine (ferx-core) inside. Installing it compiles that engine from source, so you need a Rust toolchain and the first install takes a long time. The ferx-r README notes that later installs are faster.
Requirements
-
R with a working build toolchain. The package’s
SystemRequirementsare GNU make, Cargo and rustc (>= 1.70). - Rust: a standard stable toolchain installed with rustup. No custom toolchain is required.
- Windows: Rtools matching your R version, plus the GNU-ABI Rust toolchain. See the Windows notes in the ferx-r README.
Installing the pinned build
This book documents one specific ferx-r commit, 6e2f701 (package version 0.3.0, engine ferx-core d66046e). Every output in the book was produced with it. To get exactly the same behaviour, install that commit:
install.packages("pak")
pak::pak("FeRx-NLME/ferx-r@6e2f701ddd8efd975711a5e66bc667f3ad5c60be")Installing without a commit gives you the latest development version. That is fine for your own work, but its output can differ from what this book shows:
pak::pak("FeRx-NLME/ferx-r")Checking the installation
Load the package and confirm the version:
The package ships example models and datasets, so a real fit is the quickest end-to-end check. It exercises the model parser, the data reader and the estimation engine:
ex <- ferx_example("warfarin")
fit <- ferx_fit(ex$model, ex$data, verbose = FALSE)
fit$converged
#> [1] TRUEIf this prints TRUE, ferx is installed and working. A complete analysis in one chapter walks through the same example as a full analysis.
ferx_fit() checks for R interrupts while it runs, so Ctrl-C (or RStudio’s stop button) cancels a fit. The call then ends with an error saying the fit was cancelled. The ferx-core installation page describes the behaviour in detail.
Reference
- ferx-r: README: installation, including Windows and Docker
- ferx-core: installation
- R help:
?ferx_example,?ferx_fit