climatch_par {Euclimatch} | R Documentation |
Run climatch in parallel
Description
Run climatch in parallel
Usage
climatch_par(recipient,
source,
globvar,
biovar = 1:length(globvar),
ncores,
type = "perc",
threshold = 6)
Arguments
recipient |
List of data.frames of the recipient regions |
source |
List of dataf.rames of the source regions |
globvar |
Vector of the global variance of each variable |
biovar |
Vector of the columns (climate variables) to use, default all columns |
ncores |
The number of cores to use in parallel |
type |
Choose between "perc" (default) or "mean" passed to climatch_sum() and "vec" passes to climatch_vec() |
threshold |
The climatch score (0-10) to use in calculating the percentage match, which is the number of grid cells within the recipient region with a climatch >= the threshold (default is 6). |
Value
"perc" and "mean" returns data.frame of climatch within recipients (rows) for each source represented in columns, "vec" returns data.frame of climatch of a recipient (each column corresponds to grid cell), to sources (corresponding to rows)
Examples
# Dummy data
i1 <- data.frame("clim1" = 1:10, "clim2" = 9:18) # Fake source climate data
i <- list(i1, i1) # list the source dataframes
j1 <- data.frame("clim1" = 11:20, "clim2" = 16:25) # Fake recipient climate data
j <- list(j1, j1) # list the recipient dataframes
variance <- c(60, 80) # Fake global variance
# Climate matching
climatch_par(recipient = j, source = i, globvar = variance, ncores = 1, type = "vec")