|
95 | 95 | #' |
96 | 96 | #' # examples with simulated data |
97 | 97 | #' |
98 | | -#' set.seed(2) |
| 98 | +#' set.seed(44) #2 |
99 | 99 | #' tree <- rtree(50) |
100 | 100 | #' #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) |
104 | 104 | #' |
105 | 105 | #' #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") |
110 | 114 | #' |
111 | 115 | #' #compare number of nodes |
112 | 116 | #' Nnode(tree) #original |
|
117 | 121 | #' |
118 | 122 | #' #let's compare original tree with unordered-resolved tree |
119 | 123 | #' 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) |
124 | 130 | #' #some resolution gained |
125 | 131 | #' |
126 | 132 | #' #now let's compare the original and ordered, both biasStates = NULL |
127 | 133 | #' layout(1:2) |
128 | | -#' quickAncPlot(tree,trait,orderedChar = FALSE,cex = 0.3) |
| 134 | +#' quickAncPlot(tree, trait, |
| 135 | +#' orderedChar = FALSE,cex = 0.3) |
129 | 136 | #' 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) |
131 | 139 | #' text(x = 43,y = 10,"orderedChar = TRUE",cex = 1.5) |
132 | 140 | #' |
133 | 141 | #' #now let's compare the three ordered trees |
134 | 142 | #' 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) |
140 | 153 | #' text(x = 42,y = 8,"ordered, biasStates = 'derived'",cex = 1.5) |
141 | 154 | #' |
142 | 155 | #' #let's compare unordered with ordered, biasStates = 'primitive' |
143 | 156 | #' 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) |
149 | 164 | #' |
150 | 165 | #' |
151 | | -#' #these comparisons will differ greatly between datasets |
| 166 | +#' #these comparisons will differ greatly between data sets |
152 | 167 | #' # need to try them on your own |
153 | 168 | #' |
154 | 169 | #' layout(1) |
|
0 commit comments