Enhances {this.path} | R Documentation |
Functions That Enhance the Use of Other Packages
Description
These functions improve the user experience of other packages.
Usage
## enchances 'package:box'
with_script_path(expr, local = FALSE, n = 0, envir = parent.frame(n + 1),
matchThisEnv = getOption("topLevelEnvironment"),
srcfile = if (n) sys.parent(n) else 0)
## enchances 'package:rprojroot'
make_fix_file(criterion, local = FALSE, n = 0, envir = parent.frame(n + 1),
matchThisEnv = getOption("topLevelEnvironment"),
srcfile = if (n) sys.parent(n) else 0)
Arguments
expr |
an expression to evaluate after setting the current script in
package:box; most commonly a call to
|
criterion |
argument passed to
|
local , n , envir , matchThisEnv , srcfile |
See
|
Details
with_script_path()
improves the experience of package:box; it
sets the current script in package:box to this.path()
using box::set_script_path()
, then evaluates
its argument, most commonly a package:box import statement.
make_fix_file()
improves the experience of package:rprojroot; it
looks for a project root starting with this.dir()
, then makes a
function that constructs file paths against said project root.
Value
for with_script_path()
, the result of evaluating expr
.
for make_fix_file()
, a function with formals (..., .. = 0)
that
returns a character vector.
Examples
# this.path::with_script_path(
# box::use(
# <import 1>,
# <import 2>,
# <...>
# )
# )
# ## replace 'rprojroot::is_r_package' with desired criterion
#
# fix_file <- this.path::make_fix_file(rprojroot::is_r_package)