Skip to content

Commit 50bd7b6

Browse files
committed
update resolveTreeChar example code
1 parent a524f61 commit 50bd7b6

File tree

2 files changed

+80
-50
lines changed

2 files changed

+80
-50
lines changed

R/resolveTreeChar.R

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,22 @@
9595
#'
9696
#' # examples with simulated data
9797
#'
98-
#' set.seed(2)
98+
#' set.seed(44) #2
9999
#' tree <- rtree(50)
100100
#' #simulate under a likelihood model
101-
#' trait <- rTraitDisc(tree,k = 3,rate = 0.7)
102-
#' tree <- degradeTree(tree,prop_collapse = 0.6)
103-
#' tree <- ladderize(tree,right = FALSE)
101+
#' trait <- rTraitDisc(tree, k = 3, rate = 0.7)
102+
#' tree <- degradeTree(tree, prop_collapse = 0.6)
103+
#' tree <- ladderize(tree, right = FALSE)
104104
#'
105105
#' #a bunch of type = MPR (default) examples
106-
#' treeUnord <- resolveTreeChar(tree,trait,orderedChar = FALSE)
107-
#' treeOrd <- resolveTreeChar(tree,trait,orderedChar = TRUE,stateBias = NULL)
108-
#' treeOrdPrim <- resolveTreeChar(tree,trait,orderedChar = TRUE,stateBias = "primitive")
109-
#' treeOrdDer <- resolveTreeChar(tree,trait,orderedChar = TRUE,stateBias = "derived")
106+
#' treeUnord <- resolveTreeChar(tree, trait,
107+
#' orderedChar = FALSE)
108+
#' treeOrd <- resolveTreeChar(tree, trait,
109+
#' orderedChar = TRUE, stateBias = NULL)
110+
#' treeOrdPrim <- resolveTreeChar(tree, trait,
111+
#' orderedChar = TRUE, stateBias = "primitive")
112+
#' treeOrdDer <- resolveTreeChar(tree, trait,
113+
#' orderedChar = TRUE, stateBias = "derived")
110114
#'
111115
#' #compare number of nodes
112116
#' Nnode(tree) #original
@@ -117,38 +121,49 @@
117121
#'
118122
#' #let's compare original tree with unordered-resolved tree
119123
#' layout(1:2)
120-
#' quickAncPlot(tree,trait,orderedChar = FALSE,cex = 0.3)
121-
#' text(x = 43,y = 10,"Original",cex = 1.5)
122-
#' quickAncPlot(treeUnord,trait,orderedChar = FALSE,cex = 0.3)
123-
#' text(x = 43,y = 10,"orderedChar = FALSE",cex = 1.5)
124+
#' quickAncPlot(tree, trait,
125+
#' orderedChar = FALSE, cex = 0.3)
126+
#' text(x = 43, y = 10,"Original", cex = 1.5)
127+
#' quickAncPlot(treeUnord, trait,
128+
#' orderedChar = FALSE, cex = 0.3)
129+
#' text(x = 43, y = 10, "orderedChar = FALSE", cex = 1.5)
124130
#' #some resolution gained
125131
#'
126132
#' #now let's compare the original and ordered, both biasStates = NULL
127133
#' layout(1:2)
128-
#' quickAncPlot(tree,trait,orderedChar = FALSE,cex = 0.3)
134+
#' quickAncPlot(tree, trait,
135+
#' orderedChar = FALSE,cex = 0.3)
129136
#' text(x = 43,y = 10,"Original",cex = 1.5)
130-
#' quickAncPlot(treeOrd,trait,orderedChar = TRUE,cex = 0.3)
137+
#' quickAncPlot(treeOrd, trait,
138+
#' orderedChar = TRUE,cex = 0.3)
131139
#' text(x = 43,y = 10,"orderedChar = TRUE",cex = 1.5)
132140
#'
133141
#' #now let's compare the three ordered trees
134142
#' layout(1:3)
135-
#' quickAncPlot(treeOrd,trait,orderedChar = TRUE,cex = 0.3)
136-
#' text(x = 41,y = 8,"ordered, biasStates = NULL",cex = 1.5)
137-
#' quickAncPlot(treeOrdPrim,trait,orderedChar = TRUE,cex = 0.3)
138-
#' text(x = 41.5,y = 8,"ordered, biasStates = 'primitive'",cex = 1.5)
139-
#' quickAncPlot(treeOrdDer,trait,orderedChar = TRUE,cex = 0.3)
143+
#' quickAncPlot(treeOrd, trait,
144+
#' orderedChar = TRUE,cex = 0.3)
145+
#' text(x = 41, y = 8,
146+
#' "ordered, biasStates = NULL", cex = 1.5)
147+
#' quickAncPlot(treeOrdPrim, trait,
148+
#' orderedChar = TRUE,cex = 0.3)
149+
#' text(x = 41.5, y = 8,
150+
#' "ordered, biasStates = 'primitive'", cex = 1.5)
151+
#' quickAncPlot(treeOrdDer, trait,
152+
#' orderedChar = TRUE,cex = 0.3)
140153
#' text(x = 42,y = 8,"ordered, biasStates = 'derived'",cex = 1.5)
141154
#'
142155
#' #let's compare unordered with ordered, biasStates = 'primitive'
143156
#' layout(1:2)
144-
#' quickAncPlot(treeUnord,trait,orderedChar = FALSE,cex = 0.3)
145-
#' text(x = 41,y = 8,"orderedChar = FALSE",cex = 1.5)
146-
#' quickAncPlot(treeOrdPrim,trait,orderedChar = TRUE,cex = 0.3)
147-
#' text(x = 40,y = 11,"orderedChar = TRUE",cex = 1.5)
148-
#' text(x = 40,y = 4,"biasStates = 'primitive'",cex = 1.5)
157+
#' quickAncPlot(treeUnord, trait,
158+
#' orderedChar = FALSE, cex = 0.3)
159+
#' text(x = 41, y = 8, "orderedChar = FALSE", cex = 1.5)
160+
#' quickAncPlot(treeOrdPrim, trait,
161+
#' orderedChar = TRUE, cex = 0.3)
162+
#' text(x = 40, y = 11, "orderedChar = TRUE", cex = 1.5)
163+
#' text(x = 40, y = 4, "biasStates = 'primitive'", cex = 1.5)
149164
#'
150165
#'
151-
#' #these comparisons will differ greatly between datasets
166+
#' #these comparisons will differ greatly between data sets
152167
#' # need to try them on your own
153168
#'
154169
#' layout(1)

man/resolveTreeChar.Rd

Lines changed: 40 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)