[Phylobase-commits] r565 - in pkg: man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 22 00:10:24 CEST 2009


Author: francois
Date: 2009-08-22 00:10:24 +0200 (Sat, 22 Aug 2009)
New Revision: 565

Modified:
   pkg/man/check.phylo4d.Rd
   pkg/man/phylo4d.Rd
   pkg/tests/misctests.Rout.save
Log:
created some more examples in documentation, removed some obsolete part of doc, updated output of misctests because of the new examples

Modified: pkg/man/check.phylo4d.Rd
===================================================================
--- pkg/man/check.phylo4d.Rd	2009-08-21 22:08:02 UTC (rev 564)
+++ pkg/man/check.phylo4d.Rd	2009-08-21 22:10:24 UTC (rev 565)
@@ -98,13 +98,7 @@
 p4d.all2 <- phylo4d(p4, all.data = rbind(dat, nod.dat, match.data=FALSE))
 
 ## examples of merge.data
-data(geospiza)
-trGeo <- extractTree(geospiza)
-tDt <- data.frame(a=rnorm(nTips(trGeo)), row.names=nodeId(trGeo, "tip"))
-nDt <- data.frame(a=rnorm(nNodes(trGeo)), row.names=nodeId(trGeo, "internal"))
 
-(matchData1 <- phylo4d(trGeo, tip.data=tDt, node.data=nDt, merge.data=FALSE))
-(matchData2 <- phylo4d(trGeo, tip.data=tDt, node.data=nDt, merge.data=TRUE))
 
 }
 \keyword{misc}

Modified: pkg/man/phylo4d.Rd
===================================================================
--- pkg/man/phylo4d.Rd	2009-08-21 22:08:02 UTC (rev 564)
+++ pkg/man/phylo4d.Rd	2009-08-21 22:10:24 UTC (rev 565)
@@ -42,7 +42,7 @@
   tip and node labels?}
   \item{merge.data}{if both \code{tip.data} and \code{node.data} are
     provided, it determines if they should be merged as a single
-    trait. This argument is evaluated only if both \code{tip.data} and
+    trait (if TRUE). This argument is evaluated only if both \code{tip.data} and
     \code{node.data} have identical column names.}
   \item{check.node.labels}{if \code{x} is of class \code{phylo}, use
     either "keep" (the default) to retain internal node labels, "drop"
@@ -118,23 +118,29 @@
 
 exGeo2 <- phylo4d(geoTree, tip.data = geoData, node.data = rNodeData)
 
-### Example using 'merge.tip.node'
-## some random tip data
-rTipData <- data.frame(randomTrait = rnorm(nTips(geoTree)),
-                       row.names = labels(geoTree))
+### Example using 'merge.data'
+data(geospiza)
+trGeo <- extractTree(geospiza)
+tDt <- data.frame(a=rnorm(nTips(trGeo)), row.names=nodeId(trGeo, "tip"))
+nDt <- data.frame(a=rnorm(nNodes(trGeo)), row.names=nodeId(trGeo, "internal"))
 
-(exGeo3 <- phylo4d(geoTree, tip.data = rTipData, node.data = rNodeData))
-(exGeo4 <- phylo4d(geoTree, tip.data = rTipData, node.data = rNodeData,
-                    merge.data = FALSE))
+(matchData1 <- phylo4d(trGeo, tip.data=tDt, node.data=nDt, merge.data=FALSE))
+(matchData2 <- phylo4d(trGeo, tip.data=tDt, node.data=nDt, merge.data=TRUE))
 
-                    ### Example with 'all.data'x
+## Example with 'all.data'
 nodeLabels(geoTree) <- as.character(nodeId(geoTree))
 rAllData <- data.frame(randomTrait = rnorm(nTips(geoTree) + nNodes(geoTree)),
 row.names = labels(geoTree, 'all'))
 
-
 exGeo5 <- phylo4d(geoTree, all.data = rAllData)
 
+## Examples using 'rownamesAsLabels' and comparing with match.data=FALSE
+tDt <- data.frame(x=letters[1:nTips(trGeo)],
+                  row.names=sample(nodeId(trGeo, "tip")))
+tipLabels(trGeo) <- as.character(sample(1:nTips(trGeo)))
+(exGeo6 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=TRUE))
+(exGeo7 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=FALSE))
+(exGeo8 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=FALSE, match.data=FALSE))
 
 }
 \keyword{misc}

Modified: pkg/tests/misctests.Rout.save
===================================================================
--- pkg/tests/misctests.Rout.save	2009-08-21 22:08:02 UTC (rev 564)
+++ pkg/tests/misctests.Rout.save	2009-08-21 22:10:24 UTC (rev 565)
@@ -229,26 +229,60 @@
 
 phyl4d> exGeo2 <- phylo4d(geoTree, tip.data = geoData, node.data = rNodeData)
 
-phyl4d> ### Example using 'merge.tip.node'
-phyl4d> ## some random tip data
-phyl4d> rTipData <- data.frame(randomTrait = rnorm(nTips(geoTree)),
-phyl4d+                        row.names = labels(geoTree))
+phyl4d> ### Example using 'merge.data'
+phyl4d> data(geospiza)
 
-phyl4d> (exGeo3 <- phylo4d(geoTree, tip.data = rTipData, node.data = rNodeData))
-          label node ancestor edge.length node.type randomTrait
-15         <NA>   15       NA          NA      root -0.62645381
-16         <NA>   16       15     0.29744  internal  0.18364332
-17         <NA>   17       16     0.04924  internal -0.83562861
-18         <NA>   18       17     0.06859  internal  1.59528080
-19         <NA>   19       18     0.13404  internal  0.32950777
-20         <NA>   20       19     0.10346  internal -0.82046838
-21         <NA>   21       20     0.03550  internal  0.48742905
-22         <NA>   22       21     0.00917  internal  0.73832471
-23         <NA>   23       22     0.07333  internal  0.57578135
-24         <NA>   24       23     0.05500  internal -0.30538839
-25         <NA>   25       19     0.24479  internal  1.51178117
-26         <NA>   26       25     0.05167  internal  0.38984324
-27         <NA>   27       26     0.01500  internal -0.62124058
+phyl4d> trGeo <- extractTree(geospiza)
+
+phyl4d> tDt <- data.frame(a=rnorm(nTips(trGeo)), row.names=nodeId(trGeo, "tip"))
+
+phyl4d> nDt <- data.frame(a=rnorm(nNodes(trGeo)), row.names=nodeId(trGeo, "internal"))
+
+phyl4d> (matchData1 <- phylo4d(trGeo, tip.data=tDt, node.data=nDt, merge.data=FALSE))
+          label node ancestor edge.length node.type           a         a.1
+15         <NA>   15       NA          NA      root          NA -1.47075238
+16         <NA>   16       15     0.29744  internal          NA -0.47815006
+17         <NA>   17       16     0.04924  internal          NA  0.41794156
+18         <NA>   18       17     0.06859  internal          NA  1.35867955
+19         <NA>   19       18     0.13404  internal          NA -0.10278773
+20         <NA>   20       19     0.10346  internal          NA  0.38767161
+21         <NA>   21       20     0.03550  internal          NA -0.05380504
+22         <NA>   22       21     0.00917  internal          NA -1.37705956
+23         <NA>   23       22     0.07333  internal          NA -0.41499456
+24         <NA>   24       23     0.05500  internal          NA -0.39428995
+25         <NA>   25       19     0.24479  internal          NA -0.05931340
+26         <NA>   26       25     0.05167  internal          NA  1.10002537
+27         <NA>   27       26     0.01500  internal          NA  0.76317575
+1    fuliginosa    1       24     0.05500       tip -2.21469989          NA
+2        fortis    2       24     0.05500       tip  1.12493092          NA
+3  magnirostris    3       23     0.11000       tip -0.04493361          NA
+4   conirostris    4       22     0.18333       tip -0.01619026          NA
+5      scandens    5       21     0.19250       tip  0.94383621          NA
+6    difficilis    6       20     0.22800       tip  0.82122120          NA
+7       pallida    7       25     0.08667       tip  0.59390132          NA
+8      parvulus    8       27     0.02000       tip  0.91897737          NA
+9    psittacula    9       27     0.02000       tip  0.78213630          NA
+10       pauper   10       26     0.03500       tip  0.07456498          NA
+11   Platyspiza   11       18     0.46550       tip -1.98935170          NA
+12        fusca   12       17     0.53409       tip  0.61982575          NA
+13 Pinaroloxias   13       16     0.58333       tip -0.05612874          NA
+14     olivacea   14       15     0.88077       tip -0.15579551          NA
+
+phyl4d> (matchData2 <- phylo4d(trGeo, tip.data=tDt, node.data=nDt, merge.data=TRUE))
+          label node ancestor edge.length node.type           a
+15         <NA>   15       NA          NA      root -1.47075238
+16         <NA>   16       15     0.29744  internal -0.47815006
+17         <NA>   17       16     0.04924  internal  0.41794156
+18         <NA>   18       17     0.06859  internal  1.35867955
+19         <NA>   19       18     0.13404  internal -0.10278773
+20         <NA>   20       19     0.10346  internal  0.38767161
+21         <NA>   21       20     0.03550  internal -0.05380504
+22         <NA>   22       21     0.00917  internal -1.37705956
+23         <NA>   23       22     0.07333  internal -0.41499456
+24         <NA>   24       23     0.05500  internal -0.39428995
+25         <NA>   25       19     0.24479  internal -0.05931340
+26         <NA>   26       25     0.05167  internal  1.10002537
+27         <NA>   27       26     0.01500  internal  0.76317575
 1    fuliginosa    1       24     0.05500       tip -2.21469989
 2        fortis    2       24     0.05500       tip  1.12493092
 3  magnirostris    3       23     0.11000       tip -0.04493361
@@ -264,44 +298,109 @@
 13 Pinaroloxias   13       16     0.58333       tip -0.05612874
 14     olivacea   14       15     0.88077       tip -0.15579551
 
-phyl4d> (exGeo4 <- phylo4d(geoTree, tip.data = rTipData, node.data = rNodeData,
-phyl4d+                     merge.data = FALSE))
-          label node ancestor edge.length node.type randomTrait randomTrait.1
-15         <NA>   15       NA          NA      root          NA    -0.6264538
-16         <NA>   16       15     0.29744  internal          NA     0.1836433
-17         <NA>   17       16     0.04924  internal          NA    -0.8356286
-18         <NA>   18       17     0.06859  internal          NA     1.5952808
-19         <NA>   19       18     0.13404  internal          NA     0.3295078
-20         <NA>   20       19     0.10346  internal          NA    -0.8204684
-21         <NA>   21       20     0.03550  internal          NA     0.4874291
-22         <NA>   22       21     0.00917  internal          NA     0.7383247
-23         <NA>   23       22     0.07333  internal          NA     0.5757814
-24         <NA>   24       23     0.05500  internal          NA    -0.3053884
-25         <NA>   25       19     0.24479  internal          NA     1.5117812
-26         <NA>   26       25     0.05167  internal          NA     0.3898432
-27         <NA>   27       26     0.01500  internal          NA    -0.6212406
-1    fuliginosa    1       24     0.05500       tip -2.21469989            NA
-2        fortis    2       24     0.05500       tip  1.12493092            NA
-3  magnirostris    3       23     0.11000       tip -0.04493361            NA
-4   conirostris    4       22     0.18333       tip -0.01619026            NA
-5      scandens    5       21     0.19250       tip  0.94383621            NA
-6    difficilis    6       20     0.22800       tip  0.82122120            NA
-7       pallida    7       25     0.08667       tip  0.59390132            NA
-8      parvulus    8       27     0.02000       tip  0.91897737            NA
-9    psittacula    9       27     0.02000       tip  0.78213630            NA
-10       pauper   10       26     0.03500       tip  0.07456498            NA
-11   Platyspiza   11       18     0.46550       tip -1.98935170            NA
-12        fusca   12       17     0.53409       tip  0.61982575            NA
-13 Pinaroloxias   13       16     0.58333       tip -0.05612874            NA
-14     olivacea   14       15     0.88077       tip -0.15579551            NA
-
-phyl4d>                     ### Example with 'all.data'x
+phyl4d> ## Example with 'all.data'
 phyl4d> nodeLabels(geoTree) <- as.character(nodeId(geoTree))
 
 phyl4d> rAllData <- data.frame(randomTrait = rnorm(nTips(geoTree) + nNodes(geoTree)),
 phyl4d+ row.names = labels(geoTree, 'all'))
 
 phyl4d> exGeo5 <- phylo4d(geoTree, all.data = rAllData)
+
+phyl4d> ## Examples using 'rownamesAsLabels' and comparing with match.data=FALSE
+phyl4d> tDt <- data.frame(x=letters[1:nTips(trGeo)],
+phyl4d+                   row.names=sample(nodeId(trGeo, "tip")))
+
+phyl4d> tipLabels(trGeo) <- as.character(sample(1:nTips(trGeo)))
+
+phyl4d> (exGeo6 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=TRUE))
+   label node ancestor edge.length node.type    x
+15  <NA>   15       NA          NA      root <NA>
+16  <NA>   16       15     0.29744  internal <NA>
+17  <NA>   17       16     0.04924  internal <NA>
+18  <NA>   18       17     0.06859  internal <NA>
+19  <NA>   19       18     0.13404  internal <NA>
+20  <NA>   20       19     0.10346  internal <NA>
+21  <NA>   21       20     0.03550  internal <NA>
+22  <NA>   22       21     0.00917  internal <NA>
+23  <NA>   23       22     0.07333  internal <NA>
+24  <NA>   24       23     0.05500  internal <NA>
+25  <NA>   25       19     0.24479  internal <NA>
+26  <NA>   26       25     0.05167  internal <NA>
+27  <NA>   27       26     0.01500  internal <NA>
+1      2    1       24     0.05500       tip    i
+2     12    2       24     0.05500       tip    l
+3      8    3       23     0.11000       tip    b
+4      7    4       22     0.18333       tip    c
+5      4    5       21     0.19250       tip    n
+6      5    6       20     0.22800       tip    f
+7      9    7       25     0.08667       tip    h
+8     14    8       27     0.02000       tip    a
+9     10    9       27     0.02000       tip    e
+10     1   10       26     0.03500       tip    m
+11    11   11       18     0.46550       tip    g
+12    13   12       17     0.53409       tip    j
+13     3   13       16     0.58333       tip    k
+14     6   14       15     0.88077       tip    d
+
+phyl4d> (exGeo7 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=FALSE))
+   label node ancestor edge.length node.type    x
+15  <NA>   15       NA          NA      root <NA>
+16  <NA>   16       15     0.29744  internal <NA>
+17  <NA>   17       16     0.04924  internal <NA>
+18  <NA>   18       17     0.06859  internal <NA>
+19  <NA>   19       18     0.13404  internal <NA>
+20  <NA>   20       19     0.10346  internal <NA>
+21  <NA>   21       20     0.03550  internal <NA>
+22  <NA>   22       21     0.00917  internal <NA>
+23  <NA>   23       22     0.07333  internal <NA>
+24  <NA>   24       23     0.05500  internal <NA>
+25  <NA>   25       19     0.24479  internal <NA>
+26  <NA>   26       25     0.05167  internal <NA>
+27  <NA>   27       26     0.01500  internal <NA>
+1      2    1       24     0.05500       tip    m
+2     12    2       24     0.05500       tip    i
+3      8    3       23     0.11000       tip    k
+4      7    4       22     0.18333       tip    n
+5      4    5       21     0.19250       tip    f
+6      5    6       20     0.22800       tip    d
+7      9    7       25     0.08667       tip    c
+8     14    8       27     0.02000       tip    b
+9     10    9       27     0.02000       tip    h
+10     1   10       26     0.03500       tip    e
+11    11   11       18     0.46550       tip    g
+12    13   12       17     0.53409       tip    l
+13     3   13       16     0.58333       tip    j
+14     6   14       15     0.88077       tip    a
+
+phyl4d> (exGeo8 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=FALSE, match.data=FALSE))
+   label node ancestor edge.length node.type    x
+15  <NA>   15       NA          NA      root <NA>
+16  <NA>   16       15     0.29744  internal <NA>
+17  <NA>   17       16     0.04924  internal <NA>
+18  <NA>   18       17     0.06859  internal <NA>
+19  <NA>   19       18     0.13404  internal <NA>
+20  <NA>   20       19     0.10346  internal <NA>
+21  <NA>   21       20     0.03550  internal <NA>
+22  <NA>   22       21     0.00917  internal <NA>
+23  <NA>   23       22     0.07333  internal <NA>
+24  <NA>   24       23     0.05500  internal <NA>
+25  <NA>   25       19     0.24479  internal <NA>
+26  <NA>   26       25     0.05167  internal <NA>
+27  <NA>   27       26     0.01500  internal <NA>
+1      2    1       24     0.05500       tip    a
+2     12    2       24     0.05500       tip    b
+3      8    3       23     0.11000       tip    c
+4      7    4       22     0.18333       tip    d
+5      4    5       21     0.19250       tip    e
+6      5    6       20     0.22800       tip    f
+7      9    7       25     0.08667       tip    g
+8     14    8       27     0.02000       tip    h
+9     10    9       27     0.02000       tip    i
+10     1   10       26     0.03500       tip    j
+11    11   11       18     0.46550       tip    k
+12    13   12       17     0.53409       tip    l
+13     3   13       16     0.58333       tip    m
+14     6   14       15     0.88077       tip    n
 > obj1 <- obj2 <- obj3 <- phylo4d(z, data.frame(wing=1:4,color=factor(c("b","w","b","b")), tail=runif(4)*10), match.data=FALSE)
 > 
 > obj2 at tip.data <- as.data.frame(obj2 at tip.data[,1])
@@ -334,4 +433,4 @@
 > 
 > proc.time()
    user  system elapsed 
-  3.396   0.064   3.490 
+  2.584   0.068   2.665 



More information about the Phylobase-commits mailing list