Skip to contents

When main.R loads its packages and then runs a.R with source(), a.R only works inside main.R: run on its own, in a fresh R process, it lacks the packages and objects main.R set up first (the most common symptom is could not find function "%>%"). Such a script is therefore not run on its own; it runs as part of the script that sources it.

Usage

.repro_run_by_source(order_tbl, can_run)

Arguments

order_tbl

repro_run_order() output (its "source_edges" attribute)

can_run

named logical (by file_name): whether each script parses and has its inputs, i.e. would be run at all

Value

a named list: for each script run through source(), the script(s) that source it. Empty when there are none.

Details

A script counts as run through source() only when a chain of source() calls leads to it from a script that IS run on its own (it parses, its inputs are available, and nothing sources it). So two scripts that source each other, or a script sourced only by a script that cannot run, are still run on their own, as before.