Learn R Programming

delimtools (version 0.2.0)

collapse_others: Summarise Haplotype Metadata Down to One Row

Description

collapse_others() returns a tbl_df summarising all unique haplotype frequencies, duplicates and selected metadata into a single row.

Usage

collapse_others(data, hap_tbl, labels, cols)

Value

an object of class tbl_df.

Arguments

data

An object of class tbl_df containing sequence metadata.

hap_tbl

Output from haplotype_tbl.

labels

Column name which contains sequence names.

cols

A character vector of variables to collapse.

Author

Pedro S. Bittencourt, Rupert A. Collins.

Details

collapse_others() is a helper function to summarise metadata along with haplotype_tbl. For any given cols, collapse_others() flattens its content by unique haplotypes and its duplicates in hap_tbl.

Examples

Run this code
# summarise haplotypes
hap_tbl <- haplotype_tbl(geophagus)

# summarise country
others_df <- collapse_others(geophagus_info, hap_tbl, "gbAccession", "country")

Run the code above in your browser using DataLab