| pr_preset | R Documentation |
[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.
pr_preset(name)
name |
A single string naming a registered preset. See "Presets". |
'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.
A named list of [pagerank()] arguments.
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.
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.
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.
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.
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.
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.
‘vignette("presets")' for each preset’s full expansion, worked examples, and the precedence rule.
pr_preset("raw")
pr_preset("declared")
edges <- data.frame(from = c("A", "B"), to = c("B", "C"))
# Equivalent ways to run the raw view
pagerank(edges, preset = "raw")
do.call(pagerank, c(list(edges), pr_preset("raw")))
# An explicit argument always wins over the preset
pagerank(edges, preset = "raw", drop_isolates_flag = TRUE)
# "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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.