# comparetree

From networktree v0.2.2
by Payton Jones

##### comparetree

Quickly compares two partitions of a networktree object

##### Usage

```
comparetree(tree, id1 = 2L, id2 = 3L, transform = "detect",
highlights = 5, plot = FALSE, plot.type = c("compare", "subtract"),
layout = "constrained", ...)
```

##### Arguments

- tree
a networktree object

- id1
the first partition

- id2
the second partition

- transform
should stored correlation matrices be transformed to partial correlations or graphical lasso? Can be set to "cor", "pcor", or "glasso". Defaults to automatic detection

- highlights
the number of comparisons to highlight

- plot
plot a comparison of the two partitions?

- plot.type
"compare" or "subtract". "compare" plots the two networks side by side. "subtract" subtracts network 2 from network 1, and plots a network where edge weights indicate the difference

- layout
layout for the plots. The default "constrained" uses a FR layout from the full dataset

- ...
additional arguments passed to qgraph

##### Examples

```
# NOT RUN {
set.seed(1)
d <- data.frame(trend = 1:200, foo = runif(200, -1, 1))
d <- cbind(d, rbind(
mvtnorm::rmvnorm(100, mean = c(0, 0, 0),
sigma = matrix(c(1, 0.5, 0.5, 0.5, 1, 0.5, 0.5, 0.5, 1), ncol = 3)),
mvtnorm::rmvnorm(100, mean = c(0, 0, 0),
sigma = matrix(c(1, 0, 0.5, 0, 1, 0.5, 0.5, 0.5, 1), ncol = 3))
))
colnames(d)[3:5] <- paste0("y", 1:3)
## Generate a networktree
tree1 <- networktree(nodevars=d[,3:5], splitvars=d[,1:2])
## Print out the structure
tree1
## Compare any two partitions
comparetree(tree1, id1=2, id2=3, highlights=3)
## Add a comparison plot
comparetree(tree1, id1=2, id2=3, plot=TRUE)
# }
```

*Documentation reproduced from package networktree, version 0.2.2, License: GPL-3*

### Community examples

Looks like there are no examples yet.