Skip to contents

The module's corrective re-run calls this for a script that failed with could not find function "X" when no script of the paper defines X. In order:

Usage

.repro_missing_fn_pkgs(name, user, code_text_list, candidates)

Arguments

name

the missing function name (e.g. "%>%")

user

the file_name of the script that failed

code_text_list

named list of every R script's code text

candidates

candidate packages for step 2 (see the module)

Value

a character vector of package names to attach (empty when none)

Details

  1. When the paper's OTHER scripts attach a package that provides X, all the packages those scripts attach are returned, in the order they attach them. Such a script was written to run after them, in the same session (typically with library(tidyverse) in a script that runs first), and usually needs more than the one function that failed first: loading only magrittr for %>% would make the script fail one line later, on the first dplyr function.

  2. Otherwise, the one package among candidates that exports X (.repro_find_export_pkg()), as before.

  3. Otherwise, for %>% when no script of the paper attaches a package that provides it, "magrittr".

A package provides X when it is installed here and exports X, or, for %>%, when it is one of .repro_pipe_pkgs, or it is "tidyverse".