Simulate PageRank Changes on a Screaming Frog Bundle
Source:R/simulate_changes_screaming_frog.R
simulate_changes_screaming_frog.RdThe Screaming Frog entry point for [simulate_changes()]. A thin wrapper that mirrors [pagerank_screaming_frog()]: it reuses the same bundle -> [pagerank()] adapter to build the baseline inputs (edges, redirects, canonicals, indexability, placement, nofollow, ...), applies the same URL- and edge-level verbs, and delegates to the shared changeset engine. There is no Screaming Frog-specific simulation logic; both entry points funnel into one engine, so CSV and bundle users get identical what-if capability. The what-if's modeled redirects compose on top of the bundle's real crawled redirects (a changeset redirect for a source wins).
Usage
simulate_changes_screaming_frog(
bundle,
add_links_df = NULL,
remove_links_df = NULL,
redirect_urls_df = NULL,
remove_urls = NULL,
on_unknown_target = c("warn", "error", "allow"),
accepted_placements = NULL,
link_origins = NULL,
placement_weights = NULL,
weight_col = NULL,
apply_canonicals = TRUE,
apply_redirects = TRUE,
preset = NULL,
...,
label_baseline = "baseline",
label_proposed = "proposed"
)Arguments
- bundle
A `screaming_frog_bundle` object.
- add_links_df, remove_links_df, redirect_urls_df, remove_urls
The changeset verbs. See [simulate_changes()] for their semantics. Link and redirect endpoints (and `remove_urls`) match the bundle's raw crawled URLs (the `from`/`to` node identities before any folding), using `from`/`to` columns. A modeled `remove_urls` 404 composes on top of the bundle's real crawled status.
- on_unknown_target
How to treat a redirect or link target absent from the current graph. See [simulate_changes()].
- accepted_placements, link_origins, placement_weights, weight_col
Bundle scoring controls forwarded to the shared adapter, identical to [pagerank_screaming_frog()].
- apply_canonicals, apply_redirects, preset
Fold and view controls forwarded to the shared adapter, identical to [pagerank_screaming_frog()]. All of these shape the baseline and the proposed model equally, so the two differ only by the changeset.
- ...
Additional scoring controls passed through to both [pagerank()] calls (e.g. `self_loops`, `nofollow_action`, `damping`, `position_col`).
- label_baseline, label_proposed
Labels for the two models in the comparison output. Defaults `"baseline"` / `"proposed"`.
Value
The [simulate_changes()] output: a [compare_pagerank()] table with a `node_status` column, plus `summary`, `proposed`, and `manifest` attributes. See [simulate_changes()].
See also
[simulate_changes()] for the bare edge-list entry point and full verb semantics; [pagerank_screaming_frog()] for scoring a bundle without a what-if.
Examples
internal <- data.frame(
Address = c(
"https://example.com/", "https://example.com/a", "https://example.com/b"
),
`Status Code` = c("200", "200", "200"),
check.names = FALSE
)
links <- data.frame(
Type = c("Hyperlink", "Hyperlink"),
Source = c("https://example.com/", "https://example.com/a"),
Destination = c("https://example.com/a", "https://example.com/b"),
Follow = c("TRUE", "TRUE"),
check.names = FALSE
)
bundle <- screaming_frog_bundle(internal, links, "all_outlinks")
# Retire /a behind a redirect to /b
retire <- data.frame(
from = "https://example.com/a", to = "https://example.com/b"
)
simulate_changes_screaming_frog(bundle, redirect_urls_df = retire)
#> node_name pagerank_baseline pagerank_proposed delta
#> 1 https://example.com/b 0.4744122 0.6491228 0.1747106
#> 2 https://example.com/ 0.1844168 0.3508772 0.1664604
#> 3 https://example.com/a 0.3411710 NA NA
#> pct_change rank_baseline rank_proposed rank_delta node_status
#> 1 36.82676 1 1 0 normal
#> 2 90.26316 3 2 1 normal
#> 3 NA 2 NA NA normal
# Model /a 404-ing (its inbound authority evaporates to the waste sink)
simulate_changes_screaming_frog(
bundle,
remove_urls = "https://example.com/a"
)
#> node_name pagerank_baseline pagerank_proposed delta
#> 1 https://example.com/a 0.3411710 0.1275 -0.21367105
#> 2 https://example.com/ 0.1844168 0.1500 -0.03441678
#> 3 https://example.com/b 0.4744122 NA NA
#> pct_change rank_baseline rank_proposed rank_delta node_status
#> 1 -62.62872 2 2 0 removed-dead
#> 2 -18.66250 3 1 2 normal
#> 3 NA 1 NA NA normal