replace: Replace a dependency in a DESCRIPTION file

Description Usage Arguments Value Examples

Description

This will replace a dependency in a DESCRIPTION file, ignoring the parens

Usage

1
2
replace(from = "utlis", to = "utils", field = "Imports",
  file = "DESCRIPTION", write = FALSE)

Arguments

from

a dependency to remove (sans parenthetical version)

to

the depenency to replace (parenthetical version optional)

field

Which field should be modified (defaults to "Imports")

file

The DESCRIPTION file.

write

a logical. If 'TRUE', DESCRIPTION file will be overwritten, if 'FALSE', the file will be printed to screen.

Value

if 'write = TRUE', the specified file will be modified. If 'write = FALSE', the proposed changes.

Examples

1
2
3
4
5
tmp <- tempdir()
add(c("utils", "stats", "grDEvices (>= 3.0.0)"), file = file.path(tmp, "DESCRIPTION"), write = TRUE)
write.dcf(read.dcf(file.path(tmp, "DESCRIPTION")))
# Whoops! we misspelled grDevices. We can replace it.
replace("grDEvices", "grDevices (>= 3.4.0)", file = file.path(tmp, "DESCRIPTION"))

zkamvar/diaper documentation built on May 6, 2019, 12:04 a.m.