View source: R/compare_pagerank.R
| compare_pagerank | R Documentation |
Performs a full outer join on two PageRank result data frames and computes deltas, percentage changes, and rank changes for each node. Summary statistics are attached as an attribute.
compare_pagerank(
pr_a,
pr_b,
node_col = "node_name",
pr_col = "pagerank",
label_a = "a",
label_b = "b"
)
pr_a |
A data frame of PageRank results (model A / baseline). |
pr_b |
A data frame of PageRank results (model B / comparison). |
node_col |
Name of the node column present in both data frames. Default '"node_name"'. |
pr_col |
Name of the PageRank value column present in both data frames. Default '"pagerank"'. |
label_a |
Short label for model A (used in output column names). Default '"a"'. |
label_b |
Short label for model B (used in output column names). Default '"b"'. |
A data frame with columns:
Node identifier
PageRank scores from each model ('NA' when the node is absent from that model)
'pagerank_b - pagerank_a'
Percentage change from a to b ('NA' when a is 'NA' or 0)
Ordinal rank (1 = highest PageRank) within each model ('NA' when the node is absent)
'rank_a - rank_b' (positive = improved in b)
A '"summary"' attribute (named list) is attached with:
Spearman rank correlation on common nodes
Mean of absolute delta on common nodes
Count of nodes in b but not a
Count of nodes in a but not b
pr_a <- data.frame(
node_name = c("A", "B", "C"),
pagerank = c(0.5, 0.3, 0.2)
)
pr_b <- data.frame(
node_name = c("A", "B", "D"),
pagerank = c(0.4, 0.35, 0.25)
)
result <- compare_pagerank(pr_a, pr_b)
print(result)
attr(result, "summary")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.