guess: Guess structural characteristic of a flat file

Description Usage Arguments Details Value See Also Examples

Description

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.

Usage

 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)

Arguments

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.

Details

Here is a list of all currently available guess functions and their respective descriptions:

Value

All guess functions return an object that can be used as it's appropriate argument in readr::read_delim() or readr::locale()

See Also

readr::read_delim(), readr::locale()

Examples

 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)

Athospd/forkliftr documentation built on May 14, 2019, 9:42 a.m.