This function finds staticimports declarations and copies the objects to a target file.

staticmports declartions are comment blocks that look like this:

# @staticimports pkg:staticimports
#   map map_chr map_lgl os_name any_named any_unnamed
#   all_named all_unnamed

The pkg:staticimports means to import objects from the package named staticimports. If you use pkg:mypackage, it will import from mypackage.

On the following lines are the names of the objects to import.

The import declaration can also use a path. For example:

# @staticimports ../mystaticexports
#   map map_chr map_lgl os_name any_named any_unnamed
#   all_named all_unnamed

If a relative path is used, it will be relative to the top-leve of this project, as determined by here::here().

The statically imported objects are written a file, by default R/staticimports.R.

import(dir = here::here("R/"), outfile = here::here("R/staticimports.R"))

Arguments

dir

A directory containing .R files to scan for import declarations.

outfile

File to write to. Defaults to R/staticimports.R in the current project. Use stdout() to output to console.