View source: R/binary_to_table.R
binary_to_table | R Documentation |
This function allows to get a summary of sample sizes and frequencies
for each trait in each group. It is also mandatory to apply this
function before using the mmd
function, since the latter
only accepts table of frequencies, and cannot work with raw binary data.
binary_to_table(data, relative = FALSE)
data |
A binary (0/1 for presence/absence of traits) data frame
with |
relative |
Boolean. Indicates if the last rows of the table must contain frequencies (i.e., number of individuals having a given trait) or relative frequencies (i.e., proportions). |
A matrix with 2*K
rows (K
being the number of groups in
the dataset) and p
columns (one per trait).
The first K
rows are the sample sizes, the last K
rows are
trait frequencies.
Frédéric Santos, frederic.santos@u-bordeaux.fr
Santos, F. (2018) AnthropMMD: an R package with a graphical user interface for the mean measure of divergence. American Journal of Physical Anthropology, 165(1), 200–205. doi: 10.1002/ajpa.23336
start_mmd
## Load and visualize a binary dataset:
data(toyMMD)
head(toyMMD)
## Convert this dataframe into a table of sample sizes and relative frequencies:
binary_to_table(toyMMD, relative = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.