random_rep_positions: random_rep_positions

View source: R/random_rep_positions.r

random_rep_positionsR Documentation

random_rep_positions

Description

Finds positions in a vector (or matrix) that are randomly located within n_bins evenly sized bins. This is useful for 1:1 comparisons of large vectors where plotting or comparing all points is prohibitive. Only used in an example for the prop_abund() function.

Usage

random_rep_positions(x, nbins = 50)

Arguments

x

vector

nbins

number of bins to use

Value

integer vector of positions that were selected

Author(s)

John L. Darcy

Examples

# library(specificity)
# attach(endophyte)
# m_dbl <- prop_abund(otutable)
# m_int <- prop_abund(otutable, to_int=TRUE)
# head(rowSums(m_dbl))
# head(rowSums(m_int))
# # note that they are off by a little bit. This small loss in precision is OK.
# object.size(m_dbl)
# object.size(m_int)
# random_positions <- random_rep_positions(m_dbl, 100)
# plot(m_int[random_positions] ~ m_dbl[random_positions])


darcyj/specificity documentation built on Aug. 1, 2023, 8 a.m.