here {this.path}R Documentation

Construct Path to File, Beginning with this.dir()

Description

Construct the path to a file from components in a platform-independent way, starting with this.dir().

Usage

here(..., .. = 0)
ici(..., .. = 0)

Arguments

...

further arguments passed to file.path().

..

the number of directories to go back.

Details

The path to a file begins with a base. The base is .. number of directories back from the executing script's directory (this.dir()). The argument is named .. because ".." refers to the parent directory in Windows, Unix, and URL paths alike.

Value

A character vector of the arguments concatenated term-by-term, beginning with the executing script's directory.

Examples

this.path:::write.code(file = FILE <- tempfile(), {


    this.path::here()
    this.path::here(.. = 1)
    this.path::here(.. = 2)


    # use 'here' to read input from a file located nearby
    this.path::here(.. = 1, "input", "file1.csv")


    # or maybe to run another script
    this.path::here("script2.R")


})


source(FILE, echo = TRUE, verbose = FALSE)

[Package this.path version 0.11.0 Index]