Learn R Programming

dockr (version 0.8.6)

write_lines_to_file: Write Lines to File

Description

Write Lines to File

Usage

write_lines_to_file(lines, filepath = "", prepend = FALSE,
  print_file = TRUE)

Arguments

lines

character lines that will be written to file.

filepath

character filepath of file to write lines to.

prepend

logical should the new lines be prepended to the existing text? Defaults to FALSE, which implies that the new lines will be appended.

print_file

logical should the contents of the file be printed after editing? Defaults to TRUE.

Value

invisible return. Lines will be written to file as side effects to function call.

Examples

Run this code
# NOT RUN {
# create empty file.
fp <- file.path(tempdir(), "dummy")
file.create(fp)

# append lines to Dockerfile.
write_lines_to_file(c("# dummy line 1", "# dummy line 2"), 
filepath = fp)

# prepend lines to Dockerfile.
write_lines_to_file(c("# dummy line 3", "# dummy line 4"), 
filepath = fp, prepend = TRUE)
# }

Run the code above in your browser using DataLab