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.
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 type | Constructed |
|---|---|
calls | constructed by this analyzer |
extends | constructed by this analyzer |
implements | constructed by this analyzer |
uses | constructed by this analyzer |
imports | constructed by this analyzer |
exports | constructed by this analyzer |
contains | constructed by this analyzer |
references | constructed by this analyzer |
overrides | constructed by this analyzer |
instantiates | constructed by this analyzer |
decorates | ruled absent |
renders | ruled absent |
mixes_in | constructed by this analyzer |
part_of | ruled 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.zootoprintis inferred from thegeneric.classspelling at confidence 0.8 withreasonCode: "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, soe -> 6correctly 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/setGenericfor S4,setRefClassfor R5 and R6,S7::methodfor 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=frommethods=, so a data member is recorded as a field rather than as a method; a function stored in thefieldslist 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
.Rmdindexes as Markdown and the extracted.Rindexes 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.
- Which functions does this script define, and what do they call?
- Which members of this class are data and which are behaviour?
- Which named function does this closure belong to?
- Where is the generic for this S4 method declared?
What the analyzer sees in code like this
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.