A convenience wrapper around stamp_update() that appends an author to the
header's author field without duplicating anyone already listed (see
author_add()).
Arguments
- file
Character. Path to a file or directory to update.
Character. Author to add.
- action
Character. Action to perform: "modify", "dryrun", or "backup".
- recursive
Logical. When
fileis a directory, descend into subdirectories.- pattern
Character or NULL. When
fileis a directory, only update files whose name matches this pattern.
Examples
file <- tempfile(fileext = ".R")
writeLines(c("# Copyright (c) 2020", "# Author: Jane Doe", "", "x <- 1"), file)
stamp_add_author(file, "Sam Smith")
readLines(file)[2]
#> [1] "# Author: Jane Doe and Sam Smith"