Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

encoding

Guess encoding of file


Description

Uses stringi::stri_enc_detect(): see the documentation there for caveats.

Usage

guess_encoding(file, n_max = 10000, threshold = 0.2)

Arguments

file

A character string specifying an input as specified in datasource(), a raw vector, or a list of raw vectors.

n_max

Number of lines to read. If n_max is -1, all lines in file will be read.

threshold

Only report guesses above this threshold of certainty.

Value

A tibble

Examples

guess_encoding(readr_example("mtcars.csv"))
guess_encoding(read_lines_raw(readr_example("mtcars.csv")))
guess_encoding(read_file_raw(readr_example("mtcars.csv")))

guess_encoding("a\n\u00b5\u00b5")

readr

Read Rectangular Text Data

v1.4.0
GPL (>= 2) | file LICENSE
Authors
Hadley Wickham [aut], Jim Hester [aut, cre], Romain Francois [ctb], R Core Team [ctb] (Date time code adapted from R), RStudio [cph, fnd], Jukka Jylänki [ctb, cph] (grisu3 implementation), Mikkel Jørgensen [ctb, cph] (grisu3 implementation)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.