Description Usage Arguments Details Value See Also Examples
The guess
family of functions helps you figure out certain
structural characteristics of flat files without you having
to open the file and examine it manually.
What each specific function does can usually be found out by
taking a look at the corresponding readr::read_delim()
argument or
by running ?guess_*
and reading the "Details" section.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | guess_delim(file, guess_max = 10, verbose = FALSE,
encoding = guess_encoding(file, guess_max), skip = guess_skip(file,
guess_max))
guess_encoding(file, guess_max = 10, verbose = FALSE, threshold = 0.2)
guess_has_header(file, guess_max = 10, verbose = FALSE,
skip = guess_skip(file, guess_max), encoding = guess_encoding(file,
guess_max))
guess_col_types(file, guess_max = 10, verbose = FALSE,
delim = guess_delim(file, guess_max)$char[1], skip = guess_skip(file,
guess_max), encoding = guess_encoding(file, guess_max),
quote = guess_quote(file, guess_max))
guess_col_names(file, guess_max = 10, verbose = FALSE,
delim = guess_delim(file, guess_max)$char[1],
header = guess_has_header(file, guess_max), quote = guess_quote(file,
guess_max), encoding = guess_encoding(file, guess_max),
skip = guess_skip(file, guess_max))
guess_quote(file, guess_max = 10, verbose = FALSE, skip = guess_skip(file,
guess_max))
guess_skip(file, guess_max = 10, verbose = FALSE)
guess_decimal_mark(file, guess_max = 10, verbose = FALSE,
delim = guess_delim(file, guess_max)$char[1], quote = guess_quote(file,
guess_max), skip = guess_skip(file, guess_max))
guess_grouping_mark(file, guess_max = 10, verbose = FALSE)
|
file |
Path to file |
guess_max |
Maximum number of records to use for guess |
verbose |
Whether to output guess as message |
encoding |
Default encoding. This only affects how the file is read. Guessed if not specified. |
skip |
Number of lines to skip before reading data. Guessed if not specified. |
Here is a list of all currently available guess
functions and their respective
descriptions:
guess_col_names()
: guesses the column names (if the file has a header)
guess_col_types()
: guesses the column types
guess_decimal_mark()
: guesses the decimal mark used in the file
guess_delim()
: guesses the file's delimiter
guess_encoding()
: guesses the file's encoding
guess_grouping_mark()
: guesses the grouping/thousands mark used in the file
guess_has_header()
: gusses whether the file has column names
guess_quote()
: gusses the character used to quote strings (if strings are quoted)
guess_skip()
: guesses how many blank lines are at the beginning of the file
All guess
functions return an object that can be used as
it's appropriate argument in readr::read_delim()
or readr::locale()
readr::read_delim()
, readr::locale()
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
# Create sample file
file <- tempfile()
write.table(
dplyr::storms, file, sep = "|", dec = ",",
col.names = TRUE, row.names = FALSE)
# Run some guesses independetly
guess_delim(file)
guess_decimal_mark(file)
guess_col_names(file)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.