View source: R/sequence_compare.R
| plot.net_sequence_comparison | R Documentation |
Visualizes pattern-level standardized residuals across groups. Two styles are available:
"pyramid"Back-to-back bars of pattern proportions, shaded by each side's standardized residual. Requires exactly 2 groups.
"heatmap"One tile per (pattern, group) cell, colored by standardized residual. Works for any number of groups.
Residuals are read directly from the resid_<group> columns in
$patterns, which are always populated regardless of the inference
method chosen in sequence_compare.
## S3 method for class 'net_sequence_comparison'
plot(
x,
top_n = 10L,
style = c("pyramid", "heatmap"),
sort = c("statistic", "frequency"),
alpha = 0.05,
show_residuals = FALSE,
...
)
x |
A |
top_n |
Integer. Show top N patterns. Default: 10. |
style |
Character. |
sort |
Character. |
alpha |
Numeric. Significance threshold for p-value display in the pyramid. Default: 0.05. |
show_residuals |
Logical. If |
... |
Additional arguments (ignored). |
A ggplot object, invisibly.
seqs <- data.frame(
V1 = sample(LETTERS[1:4], 60, TRUE),
V2 = sample(LETTERS[1:4], 60, TRUE),
V3 = sample(LETTERS[1:4], 60, TRUE),
V4 = sample(LETTERS[1:4], 60, TRUE)
)
grp <- rep(c("X", "Y"), 30)
net <- build_network(seqs, method = "relative")
res <- sequence_compare(net, group = grp, sub = 2:3, test = "chisq")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.