Last active
July 13, 2017 06:12
-
-
Save dialektike/fd38a8fe76f32ddf41559bac144d6878 to your computer and use it in GitHub Desktop.
r에서 한글문서 열때 인코딩 문제 해결 함수. 참고: http://philogrammer.com/2017-03-15/encoding/
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
library(readr) | |
read.any <- function(text, sep = "", ...) { | |
encoding <- as.character(guess_encoding(text)[1,1]) | |
setting <- as.character(tools::file_ext(text)) | |
if(sep != "" | !(setting %in% c("csv", "txt")) ) setting <- "custom" | |
separate <- list(csv = ",", txt = "\n", custom = sep) | |
result <- read.table(text, sep = separate[[setting]], fileEncoding = encoding, ...) | |
return(result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment