setup_admb: Set up AD Model Builder environment variables

Description Usage Arguments Details Value Author(s) Examples

View source: R/setup_admb.r

Description

Attempts to set environment variables so that AD Model Builder will "just work" when run from inside R

Usage

1
2
3
setup_admb(admb_home)

       clean_admb(fn,which=c("sys","output"))

Arguments

admb_home

(character) directory containing AD Model Builder binary files

fn

(character) base name of ADMB model files

which

what to remove: any combination of "sys" (system), "input", "output", or "all" or "none"

Details

(1) If the environment variable ADMB_HOME is not already set and admb_home is not specified, this function will try to set it sensibly. (I.e., on Unix systems, it will run a "locate" command (if one is available) to try to find the binaries, and thereafter check if they are installed in the default location (/usr/local/admb); on Windows it will assume they are installed in the default location (C:/ADMB).) (2) If ADMB_HOME is set and admb_home is not specified, it will leave the original setting alone. (3) If admb_home is specified, it will set the environment variable ADMB_HOME to that value.

The function also prepends the admb_home value to the PATH variable.

Value

A character vector containing the name of the current ADMB_HOME.

Author(s)

Ben Bolker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 orig <- Sys.getenv("ADMB_HOME")
## this doesn't make sense but won't break anything
## until you actually try to run AD Model Builder
 setup_admb("elsewhere")   
 Sys.setenv(ADMB_HOME="") ## erase environment variable
## Not run: 
 setup_admb()              ## auto-locate (fails if ADMB not found)

## End(Not run)
 Sys.setenv(ADMB_HOME=orig) ## restore sanity

R2admb documentation built on March 26, 2020, 7:39 p.m.