Skip to contents

Converts clock rate tables, such as those produced by clockrate_summary and imported back after including clade names, from wide to long format.

Usage

clock_reshape(rate_table)

Arguments

rate_table

A data frame of clock rates, such as from the output of get_clockrate_table_MrBayes with an extra "clade" column.

Details

This function will convert clock rate tables from wide to long format, with a new column "clock" containing the clock partition from where each rate estimate was obtained as a factor. The long format is necessary for downstream analyses of selection strength (mode), as similarly done by FBD_reshape for posterior parameter log files.

Value

A data frame containing a single "value" column (for all rate values) and one column for the "clock" variable (indicating to which clock partition each rate values refers to)

See also

vignette("rates-selection") for the use of this function as part of an analysis pipeline.

get_clockrate_table_MrBayes, summary, clockrate_summary, FBD_reshape

Examples

# See vignette("rates-selection") for how to use this
# function as part of an analysis pipeline

## The example dataset rate_table_clades_means3
## has clades and 3 clock rate columns:
data("rate_table_clades_means3")
#> Warning: data set ‘rate_table_clades_means3’ not found

## Reshape a clock rate table with clade names to long format
if (FALSE) {
rates_by_clade <- clock_reshape(rate_table_clades_means3)
}