回复 第3楼 的 miandai:请教一下,我试图用fileEncoding但无法导入,不知为何:
<br />
> ex = scan('test.txt', fileEncoding = "UTF-8")<br />
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :<br />
scan() expected 'a real', got '?'<br />
In addition: Warning message:<br />
In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :<br />
invalid input found on input connection 'test.txt'<br />
> ex = scan('test.txt', what = 'character', fileEncoding = "UTF-8")<br />
Read 1 item<br />
Warning message:<br />
In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :<br />
invalid input found on input connection 'test.txt'<br />
</p>
我的R版本和运行平台如下:
<br />
> sessionInfo()<br />
R version 3.0.1 (2013-05-16)<br />
Platform: x86_64-w64-mingw32/x64 (64-bit)</p>
<p>locale:<br />
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252<br />
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C<br />
[5] LC_TIME=English_United States.1252 </p>
<p>attached base packages:<br />
[1] stats graphics grDevices utils datasets methods base </p>
<p>loaded via a namespace (and not attached):<br />
[1] tools_3.0.1<br />
</p>