A bug in the Mac GUI and a request
Ivan,
On Sep 28, 2006, at 10:04 AM, Ivan Alves wrote:
First the bug: R GUI version 1.17-pre (3821), Mac OS X system 10.4.7 on intel core duo. Whenever (or almost) I save the content of the quartz device (the graphics window) to a file, the window "Save Content of Quartz Device to PDF File" remains (or rather comes back) after pressing on the save button. Furthermore this window cannot be closed, except by quiting the R GUI.
Ok, we'll have a look. There are issues with Cocoa since 10.4 that are still plaguing us ...
Now the request: UTF-8 encoding support. Since I have started working with csv files encoded in UTF-8 (which appears to be the native.enc in OS X) I have had quite a headache subsetting dataframes by values of a given factor (with text encoded in UTF-8 I pressume). For instance "Compa?ia" appears as "Compa\361ia".
The problem here is that your are *not* using UTF-8. UTF-8 encoding
of "?" is (if printed as octal codes) "\303\261". So what you see is
something that is in a different encoding - AFAIC it is latin1 as you
can see easily:
In command-line R (without locale):
> iconv("Compa\361ia","latin1","UTF-8")
[1] "Compa\303\261ia"
In the GUI:
> iconv("Compa\361ia","latin1","UTF-8")
[1] "Compa?ia"
So when you are loading your table, you should be using something like
read.table(file("my.table",encoding="latin1"))
to get the correct result.
You may want to read Brian Ripley's article about encodings and
localization in the R News Vol 5/1.
Cheers,
Simon