.flipdyads | R Documentation |
flip dyads in 0/1 matrix to randomize data set
.flipdyads(x, x.dates, flips, presence = NULL, pr.dates = NULL, x.fo = NULL)
x |
data frame with association data |
x.dates |
Date, dates corresponding to rows in |
flips |
numeric, how many flips to perform |
presence |
presence matrix; see |
pr.dates |
Date, dates corresponding to rows in |
x.fo |
character string corresponding to rows in |
a table with the same dimensions as x
, except that the date column is removed if there was one in x
when it was supplied to the function.
Whitehead 2008; Bejder et al 1998
## Not run: data(dolphins) # create a presence table (all being present all the time) dpres <- createnullpresence(colnames(x)[2:19], from="2000-01-01", "2000-02-09") # without presence colSums(flipdyads(dolphins, 10)) # with presence colSums(flipdyads(dolphins, 10, dolphins$Date, presence)) dolphins[,-1] - flipdyads(dolphins, 10) sum(abs(dolphins[,-1] - flipdyads(dolphins, 20))) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.