[R] Potential R bug in identical
Layik Hama
L@H@m@ @end|ng |rom |eed@@@c@uk
Thu Jan 17 22:05:07 CET 2019
Ivan,
Thank you for digging into the string. I can confirm that the `hexdump` shows extra characters on bash, too.
The question would then be:
Why would `identical(str, "Accident_Index", ignore.case = TRUE)` behave differently on Linux/MacOS vs Windows?
Thanks
---
Layik Hama
Research Fellow
Leeds Institute for Data Analytics
Room 11.70, Worsley Building,
University of Leeds
________________________________
From: Ivan Krylov <krylov.r00t using gmail.com>
Sent: 17 January 2019 20:40:32
To: Layik Hama
Cc: r-help using r-project.org
Subject: Re: [R] Potential R bug in identical
On Thu, 17 Jan 2019 14:55:18 +0000
Layik Hama <L.Hama using leeds.ac.uk> wrote:
> There seems to be some weird and unidentifiable (to me) characters in
> front of the `Accidents_Index` column name there causing the length
> to be 17 rather than 14 characters.
Repeating the reproduction steps described at the linked pull request,
$ curl -o acc2017.zip
http://data.dft.gov.uk.s3.amazonaws.com/road-accidents-safety-data/dftRoadSafetyData_Accidents_2017.zip
$ unzip acc2017.zip
$ head -n 1 Acc.csv | hd | head -n 2
00000000 ef bb bf 41 63 63 69 64 65 6e 74 5f 49 6e 64 65 |...Accident_Inde|
00000010 78 2c 4c 6f 63 61 74 69 6f 6e 5f 45 61 73 74 69 |x,Location_Easti|
The document begins with a U+FEFF BYTE ORDER MARK, encoded in UTF-8.
Not sure which encoding R chooses on Windows by default, but
explicitly passing encoding="UTF-8" (or is it fileEncoding?) might
help decode it as such. (Sorry, cannot test my advice on Windows right
now.)
--
Best regards,
Ivan
[[alternative HTML version deleted]]
More information about the R-help
mailing list