score_tip {nichevol}R Documentation

Helper function to calculate the median bin score for a given species

Description

Helper function to calculate the median bin score for a given species

Usage

score_tip(character_table, species_name, include_unknown = FALSE)

Arguments

character_table

data.frame containing bin scores for all species. NOTE: row names must be species' names.

species_name

(character) name of the species to be analyzed.

include_unknown

(logical) whether or not unknown bin status should be included.

Value

Median bin value for a given species (for inferring sigma squared or other comparative phylogenetic analyses requiring a single continuous variable).

Examples

# Simulate data for single number bin labels
dataTable <- cbind("241" = rep("1", 5),
                   "242" = rep("1", 5),
                   "243" = c("1", "1", "0", "0", "0"),
                   "244" = c("1", "1", "0", "0", "0"),
                   "245" = c("1", "?", "0", "0", "0"))
 rownames(dataTable) <- c("GadusMorhua", "GadusMacrocephalus",
                          "GadusChalcogrammus", "ArctogadusGlacials",
                          "BoreogadusSaida")
# Simulate data for bin labels as strings
dataTableStringLabel <- cbind("241 to 244" = rep("1", 5),
                              "244 to 246" = c("1", "1", "0", "0", "0"),
                              "246 to 248" = c("1", "?", "0", "0", "0"))
rownames(dataTableStringLabel) <- c("GadusMorhua", "GadusMacrocephalus",
                                    "GadusChalcogrammus", "ArctogadusGlacials",
                                    "BoreogadusSaida")
# Use function
score_tip(character_table = dataTable, species_name = "GadusMorhua",
          include_unknown = TRUE)
score_tip(character_table = dataTableStringLabel, species_name = "GadusMorhua",
          include_unknown = FALSE)

[Package nichevol version 0.1.20 Index]