sample_newrow_presabs: Add a new row to a presence/absence matrix being...

Description Usage Arguments Details Value

View source: R/sample_newrow_presabs.R

Description

Add a new row to a presence/absence matrix being reconstructed from a matrix of pairwise shared species

Usage

1
sample_newrow_presabs(sharedmatrix, nsamples = 10000, startingmatrix = NULL)

Arguments

sharedmatrix

a matrix where each cell contains the number of species shared between the column and row.

nsamples

number of times to sample the possible new rows. Higher values take longer, but they are more likely to return the actual answers.

startingmatrix

the first few rows (two or more) of a presence/absence matrix being reconstructed. This might be, for example, the returned value from a previous run of this function.

Details

This function is the opposite of 'make_shared_sp_matrix()', which converts a presence/absence table to a matrix of pairwise shared species.

'sample_newrow_presabs()' uses a matrix of pairwise shared values to add an additional row to a presence/absence matrix being constructed from those values. If no startingmatrix is provided, this function outputs the first three rows. Otherwise, this function adds a row to the input startingmatrix.

This function randomly samples possible new rows and scores each sample based on its distance from matching the matrix of pairwise shared species.

Value

matrix (or matrices) of the input 'startingmatrix' with an additional row of presence/absence data corresponding to the best scoring sample.


pmckenz1/mcpdiversity documentation built on May 25, 2019, 9:25 a.m.