
ggplot2
which will need to be installed seperately. More examples like this can be found in exampleSummary
.modelSummary(model,topList,n,loadingBar=TRUE)
modelCreate(model,n,loadingBar=FALSE)
treeListSummary(treeList,topList,loadingBar=TRUE)
phylo4
. For example, model = function() {rtree(50)}
is allowed. It is intended that there be some randomness in the model.phylo4
and returns a number - which is intended to be a topological property of the tree.phylo4
.topList
phylo4
topList
modelSummary
generates some trees using the model created and returns a data frame with the topological summaries in topList
. The rows correspond to the trees generated and the columns to the different summaries.
modelCreate
creates a list of n trees using the model specified. Note that loadingbar
is FALSE
by default here as most model
's are likely to be quick.
treeListSummary
performs the functions in topList
on a list of trees. It returns a data frame where the rows correspond to the trees and the columns to the different summaries.treeAnalysis
and link{configurations}
for some ideas of which functions to add to topList
.
exampleSummary
for more examples of plots.## Create a function to test
maxLadd <- function(tree) {max(ladderNums(tree))}
## Create a model
## NOTE THE USE OF 'as'
bdModel <- function() {as(rlineage(0.5,0.1,Tmax=6),'phylo4')}
## A simple example of modelSummary
modelSummary(function(){rtree4(50)},topList=c(avgLadder,sackin),n=10)
## Another example using the created model and function
modelSummary(bdModel,topList=c(maxLadd,sackin),n=10,loadingBar=FALSE)
## Create a list of trees for more detailed analysis
bdTrees <- modelCreate(bdModel,10)
## Select a number of topological summaries to calculate
summaries <- c(avgLadder,maxLadd,sackin,function(tree){nConfig(tree,2)})
## Calculate these summaries for the trees in question
bdSummary <- treeListSummary(bdTrees,summaries)
names(bdSummary) <- c('avgLadder','maxLadd','Sackin','Cherries')
### 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 a plot
p <- ggplot(data=bdSummary)
# Simple bar plot
p + geom_bar(aes(avgLadder),binwidth=0.1)
# Simple scatter plot
p + geom_point(aes(x=Sackin,y=Cherries))
### See exampleSummary for more examples of plots
Run the code above in your browser using DataLab