Skip to contents

This function partitions occurrence data and background points according to a user-selected method.

Usage

part_partitionOccs(
  occs,
  bg,
  method,
  kfolds = NULL,
  bgMask = NULL,
  aggFact = NULL,
  logger = NULL,
  spN = NULL
)

Arguments

occs

data frame of cleaned or processed occurrences obtained from components occs: Obtain occurrence data or, poccs: Process occurrence data.

bg

coordinates of background points to be used for modeling.

method

character. Partitioning method to be used, one of 5 options:
(1) 'jack' Non-spatial Partition - jackknife
(2) 'rand' Non-spatial Partition - random k-fold
(3) 'block' spatial Partition - block
(4) 'cb1' spatial Partition - checkerboard 1 (K=2)
(5) 'cb2' spatial Partition - checkerboard 2 (K=4)

kfolds

numeric. Number of partitions to create if selected method is random k-fold (must be >=2). If other method then keep default of NULL.

bgMask

a RasterStack or a RasterBrick of environmental layers cropped and masked.

aggFact

numeric. Aggregation factor to be used when using checkerboard partition (must be >= 1).

logger

Stores all notification messages to be displayed in the Log Window of Wallace GUI. Insert the logger reactive list here for running in shiny, otherwise leave the default NULL.

spN

data frame of cleaned occurrences obtained from component occs: Obtain occurrence data. Used to obtain species name for logger messages.

Value

A list of two vectors containing group assignments for occurrences (occs.grp) and background points (bg.grp).

Details

This function is used in the partition occurrence data component. A user-selected method is used to partition occurrence and background points into different groups for model testing. A list of group assignments for both occurrences and background points is returned.

See also

Author

Jamie Kass <jamie.m.kass@gmail.com>

Gonzalo E. Pinilla-Buitrago <gepinillab@gmail.com>

Andrea Paz <paz.andreita@gmail.com>

Examples

if (FALSE) { # \dontrun{
envs <- envs_userEnvs(rasPath = list.files(system.file("extdata/wc",
                                           package = "wallace"),
                      pattern = ".tif$", full.names = TRUE),
                      rasName = list.files(system.file("extdata/wc",
                                           package = "wallace"),
                      pattern = ".tif$", full.names = FALSE))
occs <- read.csv(system.file("extdata/Bassaricyon_alleni.csv",
                 package = "wallace"))
bg <- read.csv(system.file("extdata/Bassaricyon_alleni_bgPoints.csv",
               package = "wallace"))
partblock <- part_partitionOccs(occs, bg, method = 'rand', kfold = 4)
} # }