writeLines: Write lines to a file

Description Usage Arguments Value See Also Examples

View source: R/writeLines.R

Description

This is a drop in replacement for base::writeLines() with restricted functionality. Compared to base::writeLines() it:

Usage

1
writeLines(text, con, sep = "\n", useBytes)

Arguments

text

A character vector to write

con

A character string of the path to a file. Throws an error if a connection object is passed.

sep

The end of line characters to use between lines.

useBytes

Ignored, with a warning.

Value

The UTF-8 encoded input text (invisibly).

See Also

readLines()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
tf <- tempfile()

writeLines(rownames(mtcars), tf)

# Trying to use connections throws an error
con <- file(tf)
try(writeLines(con))
close(con)

# Trying to use unsupported args throws a warning
writeLines(rownames(mtcars), tf, useBytes = TRUE)

unlink(tf)

brio documentation built on Dec. 11, 2021, 10:09 a.m.