convert_assoc_table_to_matrix: Convert a table with host and symbiont associations to a...

Description Usage Arguments Details Value Examples

View source: R/convert_assoc_tab_to_mat.R

Description

Converts a table of associations to an association matrix with rows as symbionts and columns as host.

Usage

1
2
3
convert_assoc_table_to_matrix(assoc_table)

make_mat(assoc_table)

Arguments

assoc_table

A dataframe with two columns

Details

Converts a dataframe with first column listing the host individually and the second column as the symbionts. If hosts have more than one symbiont list these with commas. For example, if the table is a tab-delimited file then a row should read: "Hostus_mostus Symbiont_1, Symbiont_2".

Value

A matrix with rows as symbionts and columns as hosts with 1's representing an association.

Examples

1
2
3
4
5
6
7
file_path <- system.file("extdata",
                         "gopher_lice_mapping.txt",
                          package = "treeducken")
gopher_lice_map <- read.table(file_path,
                              stringsAsFactors = FALSE,
                              header = TRUE)
gopher_lice_assoc_matrix <- convert_assoc_table_to_matrix(gopher_lice_map)

treeducken documentation built on March 3, 2021, 1:11 a.m.