On Mon, 27 Aug 2018, Sven Schreiber wrote:
Am 27.08.2018 um 15:35 schrieb Sven Schreiber:
> Am 27.08.2018 um 15:23 schrieb Allin Cottrell:
>>
>> I think the solution is (a) make sure your locale is set correctly within
>> R, using Sys.setlocale() if need be, and (b) tell R that the incoming
>> filename is in UTF-8. For the read.table() function this would be a matter
>> of appending the argument 'encoding="utf-8"',
Hm, I'm having several doubts here: R's locale here is already set at
German_Germany.1252, which is correct AFAICT. But if I understand correctly
the filename on Windows on an NTFS disk is saved in UTF16? Not sure how that
is passed on to R by the OS.
The file should be accessible if its name is given either in the
locale encoding or UTF-16 (unless it's a "mixed language" name in
which case it would have to be in UTF-16).
>> m <- as.matrix(read.table(fname, skip=1,
encoding-"utf-8"))
Next I believe the 'encoding' option in read.table refers to the contents of
the file, not its name.
Ah, I suppose you're right. Then I guess the right thing would be to
recode the filename itself:
fname <- iconv(fname, from="utf-8", to="")
(where "" means the locale).
I haven't tested that yet but I'll explore a bit.
Allin