
Find the variables each script defines at top level
Source:R/reproducibility_check.R
repro_defined_vars.RdWhen a script errors with object 'X' not found, the fix is usually to run
the script that defines X first. This scans each file for top-level
variable assignments — x <- ..., x = ..., x <<- ..., and
assign("x", ...) — so an undefined-variable error can be matched to the file
that would supply it (see the module's corrective re-run). Only assignments at
the start of a (comment-free) line are taken, which approximates "top level":
an assignment indented inside a function/for body is not a global the next
sourced script would see, and taking it would create false ordering edges.