These functions switch code blocks on/off.
Details
patter_run()
is the main switch:
If
.julia = TRUE
, the 'switch' is off if:AUTO_JULIA_INSTALL != "true"
;You are on a Linux platform and geospatial packages are currently in use;
You are on a Linux platform and
.geospatial = TRUE
;
Otherwise, the switch if off if:
You are on a Linux platform,
JULIA_SESSION = "TRUE"
and.geospatial = TRUE
;
(On Linux, geospatial libraries cannot be used simultaneously in R
and Julia
.)
patter_run_expensive()
is a subsidiary switch for particularly expensive routines:
If
PATTER_RUN_EXPENSIVE = "TRUE"
, this returnsTRUE
;Otherwise,
FALSE
is returned;
Examples
if (patter_run(.julia = TRUE, .geospatial = TRUE)) {
# Connect to `Julia` session
julia_connect()
# Use a geospatial library in `R`
map <- dat_gebco()
terra::plot(map)
# Set the map in `Julia`
set_map(map)
}
#> `patter::julia_connect()` called @ 2025-04-22 09:31:01...
#> ... Running `Julia` setup via `JuliaCall::julia_setup()`...
#> ... Validating Julia installation...
#> ... Setting up Julia project...
#> ... Handling dependencies...
#> ... `Julia` set up with 11 thread(s).
#> `patter::julia_connect()` call ended @ 2025-04-22 09:31:01 (duration: ~0 sec(s)).