Skip to contents

Generate random presence/absence matrix

Usage

ec_generate_pa(nsit, nspc, probs, ...)

ec_order_pa(x, by = c("both", "site", "species"), decreasing = TRUE)

Arguments

nsit

number of site (determine the number of rows).

nspc

number of species (determine the number of columns).

probs

numeric vector of probabilities presence of species. If there are less elements than species, then the vector is recycled and if there are more, the vector is truncated (see rep_len())

...

further arguments passed on to ec_pa().

x

a pa object or an R object to a coerced to one (see ec_as_pa()).

by

dimension along which the pa object should be ordered, default is set to "both".

decreasing

Should the sort order be increasing or decreasing? see order().

Functions

  • ec_order_pa(): Returns

Examples

ec_generate_pa(20, 10, .1)
#> ! No presence data for the following species: 1, 3, 5, 8, 10
#> ! Empty site(s): 2, 3, 5, 6, 7, 8, 11, 13, 16, 17, 18, 19, 20
#>  Presence absence matrix: 20 sites, 10 species, 7 occurrences.
#>        spc_01 spc_02 spc_03 spc_04 spc_05 spc_06 spc_07 spc_08 spc_09 spc_10
#> sit_01      0      1      0      0      0      0      0      0      0      0
#> sit_02      0      0      0      0      0      0      0      0      0      0
#> sit_03      0      0      0      0      0      0      0      0      0      0
#> sit_04      0      0      0      0      0      1      0      0      0      0
#> sit_05      0      0      0      0      0      0      0      0      0      0
#> sit_06      0      0      0      0      0      0      0      0      0      0
#> sit_07      0      0      0      0      0      0      0      0      0      0
#> sit_08      0      0      0      0      0      0      0      0      0      0
#> sit_09      0      0      0      0      0      0      0      0      1      0
#> sit_10      0      0      0      1      0      0      0      0      0      0
#>  Only the first 10 sites are displayed.
ec_order_pa(ec_generate_pa(20, 10, .1))
#> ! No presence data for the following species: 9, 10
#> ! Empty site(s): 5, 9, 11, 13, 14, 16, 17, 19, 20
#> ! No presence data for the following species: 9, 10
#> ! Empty site(s): 12, 13, 14, 15, 16, 17, 18, 19, 20
#>  Presence absence matrix: 20 sites, 10 species, 15 occurrences.
#>        spc_01 spc_02 spc_03 spc_04 spc_05 spc_06 spc_07 spc_08 spc_09 spc_10
#> sit_01      1      0      0      1      0      0      1      0      0      0
#> sit_02      1      1      1      0      0      0      0      0      0      0
#> sit_03      0      0      0      0      0      0      0      1      0      0
#> sit_04      1      0      0      0      0      0      0      0      0      0
#> sit_05      1      0      0      0      0      0      0      0      0      0
#> sit_06      0      0      0      0      1      0      0      0      0      0
#> sit_07      0      0      0      0      0      1      0      0      0      0
#> sit_08      0      0      0      1      0      0      0      0      0      0
#> sit_09      0      0      0      0      1      0      0      0      0      0
#> sit_10      0      0      1      0      0      0      0      0      0      0
#>  Only the first 10 sites are displayed.