vroom_lines {vroom} | R Documentation |
vroom_lines()
is similar to readLines()
, however it reads the lines
lazily like vroom()
, so operations like length()
, head()
, tail()
and sample()
can be done much more efficiently without reading all the data into R.
vroom_lines(
file,
n_max = Inf,
skip = 0,
na = character(),
skip_empty_rows = FALSE,
locale = default_locale(),
altrep = TRUE,
altrep_opts = deprecated(),
num_threads = vroom_threads(),
progress = vroom_progress()
)
file |
path to a local file. |
n_max |
Maximum number of lines to read. |
skip |
Number of lines to skip before reading data. If |
na |
Character vector of strings to interpret as missing values. Set this
option to |
skip_empty_rows |
Should blank rows be ignored altogether? i.e. If this
option is |
locale |
The locale controls defaults that vary from place to place.
The default locale is US-centric (like R), but you can use
|
altrep |
Control which column types use Altrep representations,
either a character vector of types, |
altrep_opts |
|
num_threads |
Number of threads to use when reading and materializing vectors. If your data contains newlines within fields the parser will automatically be forced to use a single thread only. |
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 |
lines <- vroom_lines(vroom_example("mtcars.csv"))
length(lines)
head(lines, n = 2)
tail(lines, n = 2)
sample(lines, size = 2)