Learn R Programming

iotools (version 0.3-5)

read.csv.raw: Fast data frame input

Description

A fast replacement of read.csv and read.delim which pre-loads the data as a raw vector and parses without constructing intermediate strings.

Usage

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", ...)

Value

A data frame containing a representation of the data in the file.

Arguments

file

A connection object or a character string naming a file from which to read data.

header

logical. Does a header row exist for the data.

sep

single character: field (column) separator.

skip

integer. Number of lines to skip in the input, no including the header.

fileEncoding

The name of the encoding to be assumed. Only used when con is a character string naming a file.

colClasses

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.

nrows

integer: the maximum number of rows to read in. Negative and other invalid values are ignored.

nsep

index name separator (single character) or NA if no index names are included

strict

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.

nrowsClasses

integer. Maximum number of rows of data to read to learn column types. Not used when col_types is supplied.

quote

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

Author

Taylor Arnold and Simon Urbanek

Details

See dstrsplit for the details of nsep, sep, and strict.