SampleMat2: Sample binary vector

Description Usage Arguments Details Value Author(s) See Also Examples

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

1
  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 :

Author(s)

Damien Georges

See Also

BIOMOD_FormatingData

Examples

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

Example output

Loading required package: sp
Loading required package: raster
Loading required package: parallel
Loading required package: reshape
Loading required package: ggplot2
biomod2 3.3-7 loaded.

Type browseVignettes(package='biomod2') to access directly biomod2 vignettes.
$calibration
 [1]  31  57  12  84  49  59  69  41   8  77  16  26  97  48   6  61  85   5  54
[20]  14  38  71   2  40  72  86  32  18  20  42  24  74  47  34   7  43  39  60
[39]  62  28  23   9  44  63  75  70  30  55  83  56  95  99  94  52  64  92  53
[58]  68  19  87  78  66  89  96 100  10  91  22  27  76

$evaluation
 [1]  1  3  4 11 13 15 17 21 25 29 33 35 36 37 45 46 50 51 58 65 67 73 79 80 81
[26] 82 88 90 93 98

biomod2 documentation built on May 2, 2019, 5:08 p.m.