Learn R Programming

AnthropMMD (version 4.0.3)

table_relfreq: 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)

Value

The last \(K\) rows (\(K\) being the number of groups) of

tab are simply transformed to relative frequencies.

Arguments

tab

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

Author

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

See Also

binary_to_table, start_mmd

Examples

Run this code
## 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)

Run the code above in your browser using DataLab