network_clean: A function to clean the network and tree:

Description Usage Arguments Value Examples

View source: R/network_clean.R

Description

- converts Z to binary - removes empty columns from Z - confirms tree is a phylo object when using full or distance models - removes tree tips that do not exist in the rows of Z - removes the rows of Z with no corresponding tips in the tree - orders the rows of Z according to the cophenetic function

Usage

1
network_clean(Z, tree = NULL, model.type = c("full", "distance", "affinity"))

Arguments

Z

bipartite interaction matrix. Rows should correspond to species in the tree. There should be no empty columns.

tree

'phylo' object

model.type

Indicate model to use: one of 'full', 'distance', 'affinity'

Value

Returns a list of the cleaned Z and tree objects

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Simluate a tree and Z matrix
## Not run: 
tree <- rcoal(50)
Z <- matrix(rbinom(50*200, 1, 0.01), nrow=50, ncol=200)
Z <- Z[,colSums(Z)>0]
rownames(Z) <- tree$tip.label

# Clean the network and tree
out <- network_clean(Z, tree, model='full')
str(out)

## End(Not run)

melmasri/HPprediction documentation built on May 2, 2020, 11:09 a.m.