The function adds the useful operators to use in your project. These operators include:

  • %>% Forward Pipe operator

  • %||% NULL operator

use_pipes(path = "R", export = TRUE)

Arguments

path

(character) A path pointing at where to copy the file.

export

If TRUE, the file content is exported to NAMESPACE.

Value

No return value, called for side effects.

Details

The function:

  1. Copies a file with several pipes 'path/utils-pipes.R' and

  2. Imports the purrrpackage in the project DESCRIPTION file

Examples

path <- tempfile() use_pipes(path)
#> Error : No root directory found in /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpU7s2JY/file1b747fde9b71 or its parent directories. Root criterion: contains a file "DESCRIPTION" with contents matching "^Package: "
print(readLines(file.path(path, "utils-pipes.R")))
#> [1] "#' Forward pipe operator" "#'" #> [3] "#' @name %>%" "#' @keywords internal" #> [5] "#' @importFrom purrr %>%" "#' @usage lhs \\%>\\% rhs" #> [7] "#' @rdname pipes" "#' @export" #> [9] "NULL" "" #> [11] "#' NULL operator" "#'" #> [13] "#' @name %||%" "#' @keywords internal" #> [15] "#' @importFrom purrr %||%" "#' @usage x \\%||\\% y" #> [17] "#' @rdname pipes" "#' @export" #> [19] "NULL"