check.path {this.path} | R Documentation |
Check 'this.path()' is Functioning Correctly
Description
Add check.path("path/to/file")
to the start of your script to
initialize this.path()
and check that it is returning the
expected path.
Usage
check.path(...)
check.dir(...)
check.proj(...)
Arguments
... |
further arguments passed to |
Details
check.proj()
is a specialized version of check.path()
that
checks the path up to the project root.
Value
if the expected path / / directory matches this.path()
/ /
this.dir()
, then TRUE
invisibly, otherwise an error is thrown.
Examples
# ## I have a project called 'EOAdjusted'
# ##
# ## Within this project, I have a folder called 'code'
# ## where I place all of my scripts.
# ##
# ## One of these scripts is called 'provrun.R'
# ##
# ## So, at the top of that R script, I could write:
#
#
# this.path::check.path("EOAdjusted", "code", "provrun.R")
#
# ## or:
#
# this.path::check.path("EOAdjusted/code/provrun.R")