Skip to content

Instantly share code, notes, and snippets.

@nozma
Created May 17, 2017 03:55
Show Gist options
  • Select an option

  • Save nozma/8a9c29a1d5452084b1e24cf8aa5eb781 to your computer and use it in GitHub Desktop.

Select an option

Save nozma/8a9c29a1d5452084b1e24cf8aa5eb781 to your computer and use it in GitHub Desktop.
RからExcelで文字化けしないCSVを出力する ref: http://qiita.com/nozma/items/6de3e636d175cc3d6e3f
df <- data.frame(a = letters[1:3],
b = c("あ", "い", "う"))
write.csv(df, "test.csv")
write.csv(df, "test.csv", fileEncoding = "CP932")
read.csv("test.csv", fileEncoding = "CP932")
readr::read_csv("test.csv", locale=readr::locale(encoding="CP932"))
readr::write_excel_csv(df, "test.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment