Run_CS.jl: Run Julia version of CIRCUITSCAPE from R

View source: R/Run_julia.R

Run_CS.jlR Documentation

Run Julia version of CIRCUITSCAPE from R

Description

Execute julia CS from R

Usage

Run_CS.jl(jl.inputs = NULL,
r,
CurrentMap = FALSE,
full.mat = FALSE,
EXPORT.dir = NULL,
output = "matrix",
CS_Point.File = NULL,
pairs_to_include = NULL,
pop2ind = NULL,
parallel = FALSE, 
cores = NULL,
cholmod = TRUE,
precision = FALSE, 
JULIA_HOME = NULL,
Julia_link = NULL,
rm.files = TRUE,
scratch = NULL,
is_resistance = TRUE)

Arguments

jl.inputs

Object created from running jl.prep function

r

Accepts two types of inputs. Provide either the path to the resistance surface file (.asc) or specify an R RasterLayer object

CurrentMap

Logical. If TRUE, the cumulative current resistance map will be generated during the CS run (Default = FALSE)

full.mat

Logical (Default = FALSE). If TRUE, the full distance matrix will be generated as an R object, rather than just the lower half of the distance matrix.

EXPORT.dir

Directory where CS results will be written. Only specify if Circuitscape current map outputs are requested. It is critical that there are NO SPACES in the directory, as this may cause the function to fail.

output

Specifiy either "matrix" or "raster". "matrix" will return the lower half of the pairwise resistance matrix (default), while "raster" will return a raster object of the cumulative current map. The raster map can only be returned if CurrentMap=TRUE

CS_Point.File

Provide a SpatialPoints object containing sample locations. Alternatively, specify the path to the Circuitscape formatted point file. See Circuitscape documentation for help. Only necessary to specify if jl.inputs are not specified.

pairs_to_include

Default is NULL. If you wish to use the advanced CIRCUITSCAPE setting mode to include or exclude certain pairs of sample locations, provide a vector consisting of 1 (keep) or 0 (drop) for each pairwise observation (see example). This is an option if you do not want to assess all pairwise observations. Only necessary to specify if jl.inputs are not specified.

pop2ind

Default is NULL. A vector with length equivalent to the number of populations sapled. Each value of the vector indicates the number of samples from each respective population.

parallel

(Logical; Default = FALSE) Do you want to run CIRCUITSCAPE in parallel? Only necessary to specify if jl.inputs are not specified.

cores

If 'parallel = TRUE', how many cores should be used for parallel processing? Only necessary to specify if jl.inputs are not specified.

cholmod

(Logical; Default = TRUE). Should the cholmod solver be used? See details. Only necessary to specify if jl.inputs are not specified.

precision

(Logical; Default = FALSE). Should experimental single precision method be used? See details. Only necessary to specify if jl.inputs are not specified.

JULIA_HOME

Path to the folder containing the Julia binary (See Details). Only necessary to specify if jl.inputs are not specified.

Julia_link

Specify whether R should connect to Julia using the 'JuliaCall' package or the 'XRJulia' package. Will Default to using 'JuliaCall' if not specified here or in jl.inputs

rm.files

Should all temporary files be removed after Julia run (Default = TRUE). Only necessary to specify if jl.inputs are not specified.

scratch

Scratch directory for use if write access is limited. Must be specified if raster results are desired for outputs.

is_resistance

Default = TRUE. Is the landscape represented as a resistance (TRUE) or conductance (FALSE) surface?

Value

Vector of CIRCUITSCAPE resistance distances (lower half of resistance matrix) OR a full square distance matrix if 'full.mat' = TRUE. Alternatively, a raster object of the cumulative current map can be returned when CurrentMap = TRUE and output = "raster". The 'full.mat' cannot be requested if only select pairs are being analyzed.

Author(s)

Bill Peterman <Peterman.73@osu.edu>

Examples

## To do

 
## Not run:
## *** TO BE COMPLETED *** ##

## End (Not run)

wpeterman/ResistanceGA documentation built on Nov. 20, 2023, 11:50 p.m.