Learn R Programming

phyloTop (version 1.1.1)

exampleSummary: Example Tree Summary

Description

An example of treeListSummary that has been used on the trees accompanying the package: ssTrees, homTrees and rTrees. See the examples section for some interesting plots.

Usage

data(exampleSummary)

Arguments

source

homTrees and ssTrees were created by Caroline Colijn of Imperial College London. rTrees were created with the functions of this package. rtree4 was the model used.

Details

rTrees were created using rtree4 as the model for modelCreate. ssTrees and homTrees were created by models based on the spread of disease. They they are from a transmission model with only one pathogen lineage per host. The former had a fifth of the hosts seeding five times as many infections as the others, and while the latter was homogeneous - everyone was equally infectious. They all have 60 nodes or a little more. Those generated by rtree4 have exactlly 61.

See Also

modelAnalysis for functions to create similar summaries based on your own models.

Examples

Run this code
# Load data
data(exampleSummary)

# See the format of the data
head(exampleSummary)

# Find the correlations between the numeric vectors in the summary for the two types of trees
# This can be very useful. Observe the differences in correlations 
homCor <- cor(exampleSummary[1:50,1:6])
ssCor <- cor(exampleSummary[51:100,1:6])
randCor <- cor(exampleSummary[101:150,1:6])

### I WILL NOW ILLUSTRATE SOME USES OF THE PACKAGE
### THESE METHODS USE LIBARY ggplot2
### IT WILL NEED TO BE SEPERATELY INSTALLED IF YOU WISH TO USE IT

# Initialize plot
p <- ggplot(data=exampleSummary) + facet_wrap(~Type)

# A bar plot of nLadders with colors determined by maxLadder 
p + geom_bar(aes(nLadders,fill=factor(maxLadder)),binwidth=1) +
guides(fill=guide_legend(title='maxLadder'))

# A scatter plot of maxLadder against avgLadder
p + geom_point(aes(maxLadder,avgLadder,color=Type)) + theme(legend.position='none')

Run the code above in your browser using DataLab