R: [DRAFT API] Read Text Lines from a Text File

stri_read_lines {stringi} | R Documentation

## [DRAFT API] Read Text Lines from a Text File

### Description

Reads a text file, re-encodes it, and splits it into text lines.

[THIS IS AN EXPERIMENTAL FUNCTION]

### Usage

    stri_read_lines(fname, encoding = "auto", locale = NA,
      fallback_encoding = stri_enc_get())

### Arguments

`fname` | single string with file name
`encoding` | single string; input encoding, `"auto"` for automatic detection with `stri_enc_detect2`, and `NULL` or `""` for the current default encoding.
`locale` | single string passed to `stri_enc_detect2`; `NULL` or `""` for default locale, `NA` for checking just UTF-* family
`fallback_encoding` | single string; encoding to be used if encoding detection fails; defaults to the current default encoding, see `stri_enc_get`

### Details

It is a substitute for the system's `readLines` function, with the ability to auto-detect input encodings (or to specify one manually), re-encode input without any strange function calls or sys options change, and split the text into lines with `stri_split_lines1` (which conforms with the Unicode guidelines for newline markers).

If `locale` is `NA` and auto-detection of UTF-32/16/8 fails, then `fallback_encoding` is used.

### Value

Returns a character vector, with each line of text being a single string. The output is always in UTF-8.

### See Also

Other files: `stri_read_raw`, `stri_write_lines`

[Package stringi version 1.2.4 Index]