Score a Screaming Frog bundle with PageRank
Source:R/pagerank_screaming_frog.R
pagerank_screaming_frog.RdThin convenience wrapper around [pagerank()] for the stable [screaming_frog_bundle()] handoff object. Only `bundle$edges` enter the graph. Raw observations and dedicated redirect, canonical, indexability, and resource rows stay out of the edge list and are mapped to the existing [pagerank()] arguments.
Usage
pagerank_screaming_frog(
bundle,
accepted_placements = NULL,
link_origins = NULL,
placement_weights = NULL,
weight_col = NULL,
apply_canonicals = TRUE,
apply_redirects = TRUE,
...
)Arguments
- bundle
A `screaming_frog_bundle` object.
- accepted_placements
Optional character vector of normalized placements to retain. Values must be among `"nav"`, `"header"`, `"footer"`, `"sidebar"`, and `"content"`. `NULL` keeps all graph-eligible hyperlink edges.
- link_origins
Optional character vector of normalized link origins to retain. Values must be among `"html"`, `"rendered"`, and `"html_rendered"`. `NULL` keeps all origins present in `bundle$edges`.
- placement_weights
Optional named positive numeric vector assigning edge weights by normalized placement. Unnamed or unknown placements are rejected. Edges whose placement is not named receive weight `1`.
- weight_col
Optional existing edge weight column to pass to [pagerank()]. Cannot be combined with `placement_weights`.
- apply_canonicals
Logical flag (default `TRUE`). When `TRUE` the bundle's `rel=canonical` signals are folded into the graph via [pagerank()]'s `canonicals_df`. Set `FALSE` for an as-crawled run that preserves the crawled node identities (no canonical folding) — useful when canonicals point off the crawled domain (e.g. a mirror/staging host) and would otherwise relabel crawled pages onto uncrawled targets.
- apply_redirects
Logical flag (default `TRUE`). When `TRUE` the bundle's redirect signals are folded into the graph via [pagerank()]'s `redirects_df`. Set `FALSE` to skip redirect folding and keep the as-crawled node identities.
- ...
Additional scoring controls passed to [pagerank()], such as `self_loops`, `drop_isolates_flag`, `nofollow_action`, `robots_blocked_action`, `rurl_params`, prior settings, and `damping`.
Value
The [pagerank()] result data frame. It retains the `"transition_audit"` attribute from [pagerank()] and adds a `"screaming_frog_import"` attribute containing bundle diagnostics, provenance, and wrapper filtering/weighting choices.
Examples
internal <- data.frame(
Address = c("https://example.com/", "https://example.com/a"),
`Status Code` = c("200", "200"),
check.names = FALSE
)
links <- data.frame(
Type = "Hyperlink",
Source = "https://example.com/",
Destination = "https://example.com/a",
Follow = "TRUE",
check.names = FALSE
)
bundle <- screaming_frog_bundle(internal, links, "all_outlinks")
pagerank_screaming_frog(bundle)
#> node_name pagerank
#> 1 https://example.com/ 0.3508772
#> 2 https://example.com/a 0.6491228