table_relfreq {AnthropMMD}R Documentation

Converts a table of sample sizes and frequencies into a table of sample sizes and relative frequencies.

Description

Mostly used as an internal function, but could also be convenient to transform frequencies (i.e., number of individuals having a given trait) into relative frequencies (i.e., proportions).

Usage

table_relfreq(tab)

Arguments

tab

A table of sample sizes and frequencies, such as the tables returned by the function binary_to_table.

Value

The last K rows (K being the number of groups) of tab are simply transformed to relative frequencies.

Author(s)

Frédéric Santos, frederic.santos@u-bordeaux.fr

See Also

binary_to_table, start_mmd

Examples

## Load and visualize a binary dataset:
data(toyMMD)
head(toyMMD)

## Convert this dataframe into a table of sample sizes and frequencies:
tab <- binary_to_table(toyMMD, relative = FALSE)
tab

## Convert this table into relative frequencies:
table_relfreq(tab)

[Package AnthropMMD version 4.0.3 Index]