[pagerank()] exposes many graph-preparation knobs. A **preset** is a small, named bundle of those arguments describing one recurring *view* of the link graph, so a view is a one-liner instead of a hand-assembled argument list.
Details
`pr_preset()` returns the bundle as a plain named list, so it is inspectable (print it to audit exactly what a preset does) and spliceable (`do.call(pagerank, c(list(edges), pr_preset("raw")))`). Passing the name directly – `pagerank(edges, preset = "raw")` – is equivalent.
Presets
- `"raw"`
The graph exactly as crawled: nothing is applied. Self loops are kept, isolates are kept, `rel=nofollow` is ignored (the edge votes like any other), and fold-map entries pointing at uncrawled targets are dropped rather than relabeling crawled pages onto phantom vertices. This is the faithful baseline to compare every other view against.
- `"declared"`
The graph after honoring the signals the site *declares*: `rel=nofollow` evaporates, declared canonical/redirect targets are followed even when they were not crawled, robots-blocked pages keep the authority they collect, and self loops and isolates are dropped. This is a **pure pin of the package defaults** – it changes nothing about how [pagerank()] behaves today. Its value is that it *states* the default view: a run made with `preset = "declared"` is a recorded, auditable claim about which view was intended, and it stays pinned to the bundle as documented even if a future default moves. Note that the declared **data** (`redirects_df`, `canonicals_df`, `indexability_df`) still has to be supplied by the caller – a preset sets policy, never data.
- `"reversed"`
The graph with every edge flipped (`reverse = TRUE`), yielding reverse / inverse PageRank: a page scores highly when it points *at* well-connected pages rather than when it is pointed at. The feeder view. Note that [topic_feeder_pagerank()] already reverses the graph itself, so this preset is a no-op there rather than an error.
- `"content"`
Weights edges by the page region they were found in: links in the main content keep their full vote, while links in navigation, header, footer and aside are discounted to a tenth. Site chrome is typically the large majority of a crawl's edges, so left unweighted it *manufactures* the ranking. Edges are **downweighted, never dropped** – placement is a heuristic classification, so a misclassified content link at 0.1 is a small error where a dropped one is a silent deletion, and dropping most of the graph would also manufacture isolates and dangling pages. All five placement terms are named explicitly, so this is a complete recipe rather than a partial adjustment.
This preset sets policy; the *data* is `placement_col`, which the caller must supply (it errors otherwise). [pagerank_screaming_frog()] supplies it from the bundle, so `preset = "content"` works there directly.
Presets are not composable with one another – `preset` takes a single bundle. `"content"` sets only placement weights and leaves every graph hygiene knob at its default, which *is* the `"declared"` view, so the two do not need to be combined.
Provenance
The [transition_audit] attached to a [pagerank()] result records which preset produced it, in `audit$config$preset`: the preset name for a registered preset (whether passed by name or as a `pr_preset()` result), `"custom"` for a hand-rolled bundle, and `NULL` when no preset was used. The rest of `config` records the resulting configuration, so a result can be both reconstructed and attributed to the named view it was asked for.
Precedence
Arguments resolve **explicit argument > preset > base default**. A preset value is applied only to arguments the caller did not name, so an explicit argument is never silently overridden:
“`r pagerank(edges, preset = "raw") # nofollow kept pagerank(edges, preset = "raw", nofollow_action = "drop") # "drop" wins “`
This holds through the wrappers that forward `...` to [pagerank()] ([trustrank()], [topic_sensitive_pagerank()], [topic_feeder_pagerank()], [pagerank_screaming_frog()]), with one boundary: arguments a wrapper sets itself are wrapper-owned and a preset cannot change them.
See also
`vignette("presets")` for each preset's full expansion, worked examples, and the precedence rule.
Examples
pr_preset("raw")
#> $self_loops
#> [1] "keep"
#>
#> $drop_isolates_flag
#> [1] FALSE
#>
#> $nofollow_action
#> [1] "keep"
#>
#> $out_of_scope_fold
#> [1] "keep"
#>
#> attr(,"pr_preset_name")
#> [1] "raw"
pr_preset("declared")
#> $self_loops
#> [1] "drop"
#>
#> $drop_isolates_flag
#> [1] TRUE
#>
#> $nofollow_action
#> [1] "evaporate"
#>
#> $robots_blocked_action
#> [1] "show"
#>
#> $out_of_scope_fold
#> [1] "relabel"
#>
#> attr(,"pr_preset_name")
#> [1] "declared"
edges <- data.frame(from = c("A", "B"), to = c("B", "C"))
# Equivalent ways to run the raw view
pagerank(edges, preset = "raw")
#> node_name pagerank
#> 1 A 0.1844168
#> 2 B 0.3411710
#> 3 C 0.4744122
do.call(pagerank, c(list(edges), pr_preset("raw")))
#> node_name pagerank
#> 1 A 0.1844168
#> 2 B 0.3411710
#> 3 C 0.4744122
# An explicit argument always wins over the preset
pagerank(edges, preset = "raw", drop_isolates_flag = TRUE)
#> node_name pagerank
#> 1 A 0.1844168
#> 2 B 0.3411710
#> 3 C 0.4744122
# "content" needs a placement column to read regions from. B is linked from
# the main content and C only from the footer, so B outranks C.
placed <- data.frame(
from = c("A", "A", "B", "C"),
to = c("B", "C", "A", "A"),
region = c("content", "footer", "content", "content")
)
pagerank(placed, preset = "content", placement_col = "region")
#> node_name pagerank
#> 1 A 0.48648649
#> 2 B 0.42592138
#> 3 C 0.08759214