R: File reader options

CsvReadOptions {arrow} | R Documentation

## File reader options

### Description

`CsvReadOptions`, `CsvParseOptions`, `CsvConvertOptions`, `JsonReadOptions`, and `JsonParseOptions` are containers for various file reading options. See their usage in `read_csv_arrow()` and `read_json_arrow()`, respectively.

### Factory

The `CsvReadOptions$create()` and `JsonReadOptions$create()` factory methods take the following arguments:

- `use_threads` Whether to use the global CPU thread pool

- `block_size` Block size we request from the IO layer; also determines the size of chunks when use_threads is `TRUE`. NB: if `FALSE`, JSON input must end with an empty line.

`CsvReadOptions$create()` further accepts these additional arguments:

- `skip_rows` Number of lines to skip before reading data (default 0)

- `column_names` Character vector to supply column names. If length-0 (the default), the first non-skipped row will be parsed to generate column names, unless `autogenerate_column_names` is `TRUE`.

- `autogenerate_column_names` Logical: generate column names instead of using the first non-skipped row (the default)? If `TRUE`, column names will be "f0", "f1", ..., "fN".

`CsvParseOptions$create()` takes the following arguments:

- `delimiter` Field delimiting character (default `","`)

- `quoting` Logical: are strings quoted? (default `TRUE`)

- `quote_char` Quoting character, if `quoting` is `TRUE`

- `double_quote` Logical: are quotes inside values double-quoted? (default `TRUE`)

- `escaping` Logical: whether escaping is used (default `FALSE`)

- `escape_char` Escaping character, if `escaping` is `TRUE`

- `newlines_in_values` Logical: are values allowed to contain CR (`0x0d`) and LF (`0x0a`) characters? (default `FALSE`)

- `ignore_empty_lines` Logical: should empty lines be ignored (default) or generate a row of missing values (if `FALSE`)?

`JsonParseOptions$create()` accepts only the `newlines_in_values` argument.

`CsvConvertOptions$create()` takes the following arguments:

- `check_utf8` Logical: check UTF8 validity of string columns? (default `TRUE`)

- `null_values` character vector of recognized spellings for null values. Analogous to the `na.strings` argument to `read.csv()` or `na` in `readr::read_csv()`.

- `strings_can_be_null` Logical: can string / binary columns have null values? Similar to the `quoted_na` argument to `readr::read_csv()`. (default `FALSE`)

### Methods

These classes have no implemented methods. They are containers for the options.

[Package arrow version 1.0.1 Index]