A fast replacement of read.csv
and read.delim
which
pre-loads the data as a raw vector and parses without constructing
intermediate strings.
read.csv.raw(file, header=TRUE, sep=",", skip=0L, fileEncoding="",
colClasses, nrows = -1L, nsep = NA, strict=TRUE,
nrowsClasses = 25L, quote="'\"")read.delim.raw(file, header=TRUE, sep="\t", ...)
A data frame containing a representation of the data in the file.
A connection object or a character string naming a file from which to read data.
logical. Does a header row exist for the data.
single character: field (column) separator.
integer. Number of lines to skip in the input, no including the header.
The name of the encoding to be assumed. Only used when
con
is a character string naming a file.
an optional character vector indicating the column
types. A vector of classes to be assumed for the output dataframe.
If it is a list, class(x)[1]
will be used to determine the class
of the contained element. It will not be recycled, and must
be at least as long as the longest row if strict
is TRUE
.
Possible values are "NULL"
(when the column is skipped) one of
the six atomic vector types ('character'
, 'numeric'
,
'logical'
, 'integer'
, 'complex'
, 'raw'
)
or POSIXct
.
'POSIXct' will parse date format in the form "YYYY-MM-DD hh:mm:ss.sss"
assuming GMT time zone. The separators between digits can be any
non-digit characters and only the date part is mandatory. See also
fasttime::asPOSIXct
for details.
integer: the maximum number of rows to read in. Negative and other invalid values are ignored.
index name separator (single character) or NA
if no
index names are included
logical, if FALSE
then dstrsplit
will not
fail on parsing errors, otherwise input not matching the format
(e.g. more columns than expected) will cause an error.
integer. Maximum number of rows of data to read to learn column
types. Not used when col_types
is supplied.
the set of quoting characters as a length 1 vector. To disable
quoting altogether, use quote = ""
. Quoting
is only considered for columns read as character.
additional parameters to pass to read.csv.raw
Taylor Arnold and Simon Urbanek
See dstrsplit
for the details of nsep
, sep
,
and strict
.