bru_safe_inla: Load INLA safely for examples and tests

View source: R/utils.R

bru_safe_inlaR Documentation

Load INLA safely for examples and tests

Description

Loads the INLA package with requireNamespace("INLA", quietly = TRUE), and optionally checks and sets the multicore num.threads INLA option.

Usage

bru_safe_inla(multicore = NULL, quietly = FALSE, minimum_version = "23.1.31")

Arguments

multicore

logical; if TRUE, multiple cores are allowed, and the INLA num.threads option is not checked or altered. If FALSE, forces num.threads="1:1". Default: NULL, checks if running in testthat or non-interactively, in which case sets multicore=FALSE, otherwise TRUE.

quietly

logical; if TRUE, prints diagnostic messages. Default: FALSE.

minimum_version

character; the minimum required INLA version. Default 23.1.31 (should always match the requirement in the package DESCRIPTION)

Value

logical; TRUE if INLA was loaded safely, otherwise FALSE

Examples

## Not run: 
if (bru_safe_inla()) {
  # Run inla dependent calculations
}

## End(Not run)


inlabru-org/inlabru documentation built on March 23, 2024, 11:36 a.m.