read_file {readr} | R Documentation |
Read a file into a string.
read_file(file, locale = default_locale()) read_file_raw(file)
file |
Either a path to a file, a connection, or literal data (either a single string or a raw vector). Files ending in Literal data is most useful for examples and tests. It must contain at least one new line to be recognised as data (instead of a path). |
locale |
The locale controls defaults that vary from place to place.
The default locale is US-centric (like R), but you can use
|
read_file
: A length 1 character vector with the entire file contents.
read_lines_raw
: A raw vector with the entire file contents.
read_file(file.path(R.home(), "COPYING")) read_lines_raw(readr_example("mtcars.csv"))