powered by
Guess the delimiter, quote character and decimal mark of a delimited text file. The function splits each of the first n lines by each candidate delimiter and selects the delimiter that produces the most consistent number of fields.
n
The algorithm is adapted from the vroom package.
peek_guess_delim( path, delims = c(",", "\t", " ", "|", ":", ";"), quotes = c("\"", "'"), n = 1024 )
a named list with elements:
the guessed delimiter character (or NULL)
NULL
the guessed quote character (or NULL)
the guessed decimal mark (or NULL)
path to the text file.
character vector of candidate delimiters.
character vector of candidate quote characters.
number of lines to read for guessing (default 1024).
f <- system.file(package = "fpeek", "datafiles", "test-comma.csv") peek_guess_delim(f) f <- system.file(package = "fpeek", "datafiles", "test-semicolon.csv") peek_guess_delim(f)
Run the code above in your browser using DataLab