如何通过 write_csv 正确打印 μ?
How to correctly print μ by write_csv?
write_csv()
in readr
将 μ 输出为 µ。如何使用write_csv()
?
正确输出μ
library(tidyverse)
x <- tribble(~x, 'µ')
write_csv(x, 'test.csv')
尝试设置正确的 fileEncoding = UTF
write.csv(x, 'test.csv', fileEncoding = "UTF-16")
write_csv()
当 tibble 中的字符采用 UTF-8 编码的原始字节时,将正常工作。
library(tidyverse)
x <- tribble(~x, '\xb5')
Encoding(x$x) <- 'UTF-8'
write_csv(x, 'test.csv')
write_csv()
in readr
将 μ 输出为 µ。如何使用write_csv()
?
library(tidyverse)
x <- tribble(~x, 'µ')
write_csv(x, 'test.csv')
尝试设置正确的 fileEncoding = UTF
write.csv(x, 'test.csv', fileEncoding = "UTF-16")
write_csv()
当 tibble 中的字符采用 UTF-8 编码的原始字节时,将正常工作。
library(tidyverse)
x <- tribble(~x, '\xb5')
Encoding(x$x) <- 'UTF-8'
write_csv(x, 'test.csv')