Performs the steps needed to make Julia and a set of Julia packages callable from R via JuliaConnectoR:
Arguments
- packages
Character vector of Julia package names to ensure are loaded (e.g.
c("EpiBranch", "Distributions")).- github
Named character vector of GitHub URLs for packages not in the General registry. Names must match entries in
packages. Values may be a full URL, an"owner/repo"shorthand, or"owner/repo:subdir".- state_env
An environment used to track initialisation state. The caller (typically a wrapping R package) supplies its own environment. Several consuming packages then keep separate state.
- install
If
FALSE, a missing package is an error.- project
Optional path to a Julia project directory containing a
Project.toml(and ideally aManifest.toml). When supplied, the project is activated and instantiated in a subprocess. SettingJULIA_PROJECTbefore JuliaConnectoR starts makes the server use the project. Use this when your package ships a pinned Julia environment underinst/julia/.Pkg.instantiate()fetches everything in the project's manifest;packagesthen only names the packages to load withusing.- match_manifest
If
TRUEandprojectis supplied, read the Julia version itsManifest.tomlwas resolved with and use that version, installing it with juliaup where available. Instantiating a manifest under a different Julia can fail, because it pins standard-library versions that exist only on the version that resolved it. Ignored when the user has chosen a binary throughJULIACONNECTOR_JULIABINorJULIA_BINDIR. A JuliaConnectoR server that is already running, for instance one another package started, keeps its Julia: the project is then instantiated under the matched version but loaded in the running one.- verbose
If
TRUE, print progress messages.
Details
Locates the Julia binary (see
julia_bin()).Without
project, checks in a Julia subprocess that each required package loads. If a package is missing andinstall = TRUE, installs it (from a GitHub URL if listed ingithub, otherwise from the General registry). Withproject, instantiates that project instead. Both run in a subprocess, apart from the JuliaConnectoR server.Starts (or attaches to) the JuliaConnectoR server.
Loads each package with
juliaEval("using <pkg>"). Dotted constructor names such asEpiBranch.NegBinthen resolve.
Idempotent: if state_env$ready is already TRUE, returns immediately.