R: Create paths that are safe from changing working directory.

.dot {lemon} | R Documentation

## Create paths that are safe from changing working directory.

### Description

The `.dot` functions creates functions that allows relative-like specification of paths, but are safe from changing working directory.

`.dot2` allows specification of multiple .dot functions while broadcasting the functions' names and target. This function also pushes the function into the calling environment, potentially overwriting previous funtions with same name.

### Usage

    .dot(x, root = getwd(), mustExist = FALSE, relative = FALSE,
      create = TRUE)

    .dot2(names, quiet = FALSE, ...)

### Arguments

`x` | File path that is appended to `BASEDIR`.
`root` | Root of your working directory, from which `x` is relative too.
`mustExist` | Logical value; if `TRUE` and the resulting path does not exist, it raises an error.
`relative` | For `.dot`, sets default for the returned function. For the returned function, when `TRUE`, the function returns a path relative to `root`.
`create` | Logical values, creates the target directory when `TRUE` (default).
`names` | Character vector of names
`quiet` | Logical value, suppresses output to stdout() when `TRUE`.
`...` | Arguments passed on to `.dot`.

### Value

A function that returns file paths constructed from `root`, `x`, and `...`.

Side effect: It creates the directory.

### Examples

    .data <- .dot('data')
    .data('input.txt')
    .data(c('a.txt','b.txt'))

    .dot2(c('rawdata','results'))
    .rawdata('rawfile.csv')
    .results('myresults.txt')

[Package lemon version 0.3.3 Index]