
Simple top-level string-literal variable assignments in a script
Source:R/reproducibility_check.R
dot-repro_simple_string_vars.RdA minimal constant-folder: finds assignments of the exact shape
name <- "literal" (or =/<<-) at the START of a (comment-free) line —
the same "top level" approximation repro_defined_vars() uses — and returns
the literal each name was last assigned. Only a bare quoted string is
resolved (no concatenation, no function calls); anything else leaves that
name absent from the result, so a caller asking for an unresolvable name
gets NA, never a guess.
Arguments
- code_text
the code text for a single file, comments already stripped
- calls
also resolve a call holding one quoted text and nothing else,
paste0("..."),paste("..."),file.path("..."),path.expand("...")ornormalizePath("..."), which give that text: a folder on the authors' computer was held asmain_address = paste0("~/Library/...")in 10.1111/1365-2435.14620 (#578, item 4).FALSEby default.