Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

SampleMat2

Sample binary vector


Description

SampleMat2 is an internal biomod2 function that can help user to sample a binary vector keeping the same proportion of 0s and 1s than in the initial vector.

Usage

SampleMat2(ref, ratio, as.logi = FALSE)

Arguments

ref

a binary vector

ratio

the proportion of ref to sample

as.logi

logical, if FALSE (default) id of cell will be return; if TRUE, logical vector of same length than ref will be return

Details

This function can be useful to help users to select a part of initial dataset that will be only kept for all validation procedures.

Value

A list of 2 elements is returned :

- 'calibration' Ids of cells selected for calibration (1st sample)

- 'evaluation' Ids of cells selected for evaluation (1st sample complementary)

Author(s)

Damien Georges

See Also

Examples

a <- sample(c(0,1),100, replace=TRUE)
SampleMat2(ref=a, ratio=0.7)

biomod2

Ensemble Platform for Species Distribution Modeling

v3.4.6
GPL-2
Authors
Wilfried Thuiller [aut, cre], Damien Georges [aut, cre], Robin Engler [aut], Frank Breiner [aut]
Initial release
2020-02-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.