编码对我来说总是很痛苦,而且再次用俄语文本编写文件是不可能的。我该怎么办?
>test = c("привет","пока")
>test
[1] "\320\277\321\200\320\270\320\262\320\265\321\202" "\320\277\320\276\320\272\320\260"
>Encoding(test)
[1] "unknown" "unknown"
> f = file("test.txt", encoding = "UTF-8")
> write(t,f)
Error in cat(list(...), file, sep, fill, labels, append) :
argument 1 (type 'closure') cannot be handled by 'cat'
> Encoding(test) = "UTF-8"
> test
[1] "<U+043F><U+0440><U+0438><U+0432><U+0435><U+0442>" "<U+043F><U+043E><U+043A><U+0430>"
> write(t,f)
Error in cat(list(...), file, sep, fill, labels, append) :
argument 1 (type 'closure') cannot be handled by 'cat'
我使用 R-studio 0.97.312、Mac OS 10.7.5、