df_to_kinpair: Convert dataframe or tibble to 'KinPairData' class

Description Usage Arguments Value See Also Examples

View source: R/import_kinpairs.R

Description

This function at minimum requires the dataframe to contain a column titled 'distance' containing distances between kin pairs. It can optionally contain a column of kinship values 'kinship' as well as a column of lifestage values 'lifestage'. If the file contains more than one value in the kinship or lifestage columns (e.g. bot 'FS' and 'HS') - the corresponding function parameter must be set to pick a corresponding subset of dispersed pairs. where parameters are set in the absence of file columns, these values are assigned to the returned KinPairData object.

Usage

1

Arguments

data

data.frame or tibble of kin distances - can contain $distance (kin distances), $kinship (kin cats) & $lifestage columns

kinship

character. kin category to assign or extract from data. one of PO, FS, HS, AV, GG, HAV, GGG, 1C, 1C1, 2C, GAV, HGAV, H1C , H1C1 or H2C

lifestage

character. lifestage to assign or extract from data. one of 'unknown', 'immature' or 'ovipositional'.

lifecheck

logical. If TRUE (default) tests if lifestage is valid, if FALSE, ignores this test. Set to FALSE when using custom lifestages.

Value

returns valid KinPairData object

See Also

Other import_functions: csv_to_kinpair(), read_kindata(), tsv_to_kinpair(), vector_to_kinpair()

Examples

1
2
3
4
5
mydata <- tibble::tibble(
  distance = 1:10, lifestage = "immature",
  kinship = c("FS", "FS", "FS", "FS", "FS", "FS", "HS", "HS", "HS", "HS")
)
df_to_kinpair(mydata, kinship = "FS")

kindisperse documentation built on July 28, 2021, 5:09 p.m.