Last active
August 7, 2023 13:14
-
-
Save AlbanSagouis/eec4a0866db0cb6a1f65271986d43af4 to your computer and use it in GitHub Desktop.
This simple function opens UTF-16 encoded delimited tables (such as Glonaf data) in R. Separator, decimal separator and other arguments can be passed to `data.table::fread` with `...`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read_utf16_table <- function(path, ...) { | |
stringi::stri_read_lines( | |
con = path, | |
encoding = "UTF-16LE") |> | |
stringi::stri_join(collapse = "\n") |> | |
data.table::fread(sep = "\t", ...) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment