
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ouch)
> 
> x <- anolis.ssd
> x$node[15] <- x$node[12]
> try(with(x,ouchtree(node,ancestor,time,species)))
Error : in 'ouchtree': node names must be unique.
> 
> x <- anolis.ssd
> try(with(x,ouchtree(node,ancestor[1:10],time,species)))
Error : in 'ouchtree': invalid tree: 'ancestors' must have the same length as 'nodes'.
> try(with(x,ouchtree(node,ancestor,time[1:20],species)))
Error : in 'ouchtree': invalid tree: 'times' must have the same length as 'nodes'.
> try(with(x,ouchtree(node,ancestor,time,species[1:20])))
Error : in 'ouchtree': invalid tree: 'labels' must be the same length as 'nodes'.
> 
> x$time[1] <- 10
> try(with(x,ouchtree(node,ancestor,time,species)))
Error : in 'ouchtree': the algorithms assume that the root node is at time=0.
> 
> x <- anolis.ssd
> x$ancestor[15] <- 15
> try(with(x,ouchtree(node,ancestor,time,species)))
Error : in 'ouchtree': this is no tree: node 15 is its own ancestor.
> 
> x <- anolis.ssd
> x$ancestor[15] <- NA
> try(with(x,ouchtree(node,ancestor,time,species)))
Error : in 'ouchtree': invalid tree: there must be a unique root node, designated by its having ancestor = NA.
> 
> x <- anolis.ssd
> x$ancestor[3] <- 15
> try(with(x,ouchtree(node,ancestor,time,species)))
Error : in 'ouchtree': node 3 is disconnected.
> 
> x <- anolis.ssd
> x$ancestor[15] <- 888
> try(with(x,ouchtree(node,ancestor,time,species)))
Error : in 'ouchtree': invalid tree: the ancestor of node '15' is not in the tree.
> 
> x <- anolis.ssd
> x$ancestor[15:18] <- 888
> try(with(x,ouchtree(node,ancestor,time,species)))
Error : in 'ouchtree': invalid tree: the ancestors of nodes '15', '16', '17', '18' are not in the tree.
> 
> x <- anolis.ssd
> with(x,ouchtree(node,ancestor,time,species)) -> tree
> names(as.data.frame(tree))
[1] "nodes"     "ancestors" "times"     "labels"   
> 
