Skip to content

Language record

R

R is indexed including its object systems: S4 sets and generics, R5 and R6 reference classes and S7 generics each record their own members, and a closure's calls are attributed to the nearest enclosing named function with the reason and the reduced confidence written onto the edge.

.r · 1 registry id · 11 of 14 relationship types

The registry row this page is generated from

Read at render time from the same family row the register reads, so nothing in this block can disagree with it.

Extensions
.r
Registry names
r
Recorded symbols
functions · methods · classes

Relationship types this analyzer constructs

11 of 14 constructed, read from this analyzer's source and re-derived by the languages gate. Each row below is one of the engine's types, in the engine's own order.

Relationship typeConstructed
callsconstructed by this analyzer
extendsconstructed by this analyzer
implementsconstructed by this analyzer
usesconstructed by this analyzer
importsconstructed by this analyzer
exportsconstructed by this analyzer
containsconstructed by this analyzer
referencesconstructed by this analyzer
overridesconstructed by this analyzer
instantiatesconstructed by this analyzer
decoratesruled absent
rendersruled absent
mixes_inconstructed by this analyzer
part_ofruled absent

11 constructed, 3 not constructed. All 3 absent types are recorded as ruled absent: the written reason and the corpus measurement behind each are in this family's completeness record. The register explains what each label means.

What this analyzer does not resolve

  • Most idiomatic R is closures. A call inside lapply(x, function(v) f(v)) is attributed to the nearest enclosing named symbol at confidence 0.7, carrying the reason verbatim, and a closure at top level with no enclosing function is counted as unresolved rather than given an invented source. The counters behind that — unresolved scope, calls attributed through a closure, calls to a callee that cannot be named — are published in the file's metadata.
  • S3 dispatch is a naming convention, not a declaration. An edge from print.zoo to print is inferred from the generic.class spelling at confidence 0.8 with reasonCode: "s3_dotted_name_convention", because the generic is not declared in that file. A quoted target cannot take this path: R dispatches on the literal name.
  • Scope boundaries were measured against R 4.4.3 rather than reasoned. local({ … }) IS a boundary; a plain brace block, parentheses, a call argument and a subset index are NOT — an earlier revision treated a subset ancestor as a boundary and silently dropped four real bindings. And -> and ->> bind the right-hand side, so e -> 6 correctly publishes nothing.

Every line above was written against R’s own analyzer module and is named against a construct in it, so it can be checked against the source. Nothing here is inherited from a template, or from another language’s page.

Where you meet it in a repository

Recognised by extension — .r. Everything below is about where those files actually sit in a working repository.

  • R's object systems are all plain function calls in the source — setClass/setGeneric for S4, setRefClass for R5 and R6, S7::method for S7 — and the members are read out of the lists those calls pass, so a package's API is navigable without loading it.
  • R6 splits fields= from methods=, so a data member is recorded as a field rather than as a method; a function stored in the fields list is a property by construction, because that is what the list means. S7 properties and methods each carry their own edge kind so the two stay separable.
  • R Markdown and Quarto keep the R inside fenced code blocks inside a Markdown document. The .Rmd indexes as Markdown and the extracted .R indexes as R; the two halves do not join into one call graph.

Questions this index answers

Phrased as retrievals, because that is what an index can honestly do: it holds the symbols and the edges between them, and hands them back with the evidence attached.

  1. Which functions does this script define, and what do they call?
  2. Which members of this class are data and which are behaviour?
  3. Which named function does this closure belong to?
  4. Where is the generic for this S4 method declared?

What the analyzer sees in code like this

An R5 reference class: its data member, its method, and the class they belong to
Account <- setRefClass("Account",              # bb records: class Account
  fields  = list(balance = "numeric"),    # bb records: property balance — data, not behaviour
  methods = list(
    deposit = function(amount) {         # bb records: method deposit on Account
      balance <<- balance + amount
    }))

Symbols are stored with the file they came from and the bytes they span, so a hit points at a line rather than at a guess. The annotations in the sample are commentary for the reader, not strings the index would store.

Languages that turn up in the same repository

Scripting & shell — the count beside each name is how many relationship types that family’s analyzer constructs.

The extensions, registry names, recorded symbols and relationship types above are the parser registry row for R, read while the page rendered — the same row the register reads, so the two surfaces cannot tell two stories. Every relationship type listed as constructed appears in src/ast/real-*, the analyzer modules bb ships. bb 0.1.0 answers from a local store over 50 languages (53 registry ids, three of them aliases). There is no benchmark on this page: every claim here is one you can go and read in the source.