- file
Either a path to a file, a connection, or literal data
(either a single string or a raw vector).
Files ending in .gz
, .bz2
, .xz
, or .zip
will
be automatically uncompressed. Files starting with http://
,
https://
, ftp://
, or ftps://
will be automatically
downloaded. Remote gz files can also be automatically downloaded and
decompressed.
Literal data is most useful for examples and tests. To be recognised as
literal data, the input must be either wrapped with I()
, be a string
containing at least one new line, or be a vector containing at least one
string with a new line.
Using a value of clipboard()
will read from the system clipboard.
- col_positions
Column positions, as created by fwf_empty()
,
fwf_widths()
or fwf_positions()
. To read in only selected fields,
use fwf_positions()
. If the width of the last column is variable (a
ragged fwf file), supply the last end position as NA.
- locale
The locale controls defaults that vary from place to place.
The default locale is US-centric (like R), but you can use
locale()
to create your own locale that controls things like
the default time zone, encoding, decimal mark, big mark, and day/month
names.
- na
Character vector of strings to interpret as missing values. Set this
option to character()
to indicate no missing values.
- comment
A string used to identify comments. Any text after the
comment characters will be silently ignored.
- trim_ws
Should leading and trailing whitespace (ASCII spaces and tabs) be trimmed from
each field before parsing it?
- skip
Number of lines to skip before reading data.
- n_max
Maximum number of lines to read.
- progress
Display a progress bar? By default it will only display
in an interactive session and not while knitting a document. The automatic
progress bar can be disabled by setting option readr.show_progress
to
FALSE
.
- skip_empty_rows
Should blank rows be ignored altogether? i.e. If this
option is TRUE
then blank rows will not be represented at all. If it is
FALSE
then they will be represented by NA
values in all the columns.
- col_names
Either NULL, or a character vector column names.
- n
Number of lines the tokenizer will read to determine file structure. By default
it is set to 100.
- widths
Width of each field. Use NA as width of last field when
reading a ragged fwf file.
- start, end
Starting and ending (inclusive) positions of each field.
Use NA as last end field when reading a ragged fwf file.
- ...
If the first element is a data frame,
then it must have all numeric columns and either one or two rows.
The column names are the variable names. The column values are the
variable widths if a length one vector, and if length two, variable start and end
positions. The elements of ...
are used to construct a data frame
with or or two rows as above.