get_sf_phenotype: get_sf_phenotype function

View source: R/get_sf_phenotype.R

get_sf_phenotypeR Documentation

get_sf_phenotype function

Description

Adds the social father phenotype based on a phenotype table and a metadata table. If the social father is NA (i.e. unknown), the value is NA. Function goes through each row in phenotype table and checks the father. Then we get the father's phenotype from the same table.

Usage

get_sf_phenotype(metadata, phenotype_table, phenotype_index)

Arguments

metadata:

Dataframe containing Bird.ID and the IDs of their respective social fathers (Social.Father).

phenotype_table:

Dataframe containing Bird.ID and some phenotype(s) of interest.

phenotype_index:

Index of variable of interest in phenotype_table.

Value

: The phenotype table with an additional column for the social father's phenotype.

Examples

metadata = tibble::tibble(Bird.ID = c("JS01","JS02") , Social.Father = c("JS02",NA))
phenotype_table = tibble::tibble(Bird.ID = c("JS01","JS02"), trait = c(2,3))
get_sf_phenotype(metadata, phenotype_table,2)

Anthony-Kwong/birdsong.tools documentation built on April 14, 2023, 9:50 a.m.