[R-SIG-Mac] Foreign and UTF-8 on OS X
EJ Nikelski
nikelski at bic.mni.mcgill.ca
Mon Jan 30 22:16:28 CET 2006
Hi List,
I brought this issue up in the R-help list a few months ago, and
they recommended that, as the problem looked Mac environment-related to
them, I bring it up here.
In particular, when I use the foreign package to export a dataframe
to SPSS, the data file looks good, but the command file contains a mix
of ASCII and UTF-8 quotation marks. For example, executing ...
>write.foreign(test.df, "datafile.dat", "codefile.sps", package="SPSS")
yields ...
-----------------------
DATA LIST FILE= !!!datafile.dat!!! free
/ subjID AR.efkt SR.efkt Efkt AR.corr SR.corr w.tgtPrt w.tgtUrt w.prmRrt
w.prmUrt s.tgtPrt s.tgtUrt s.prmRrt s.prmUrt tgtPrt tgtUrt prmRrt prmUrt .
VARIABLE LABELS
subjID "subjID" ... ... ...
------------------------
where !!! are UTF-8 left and right quotes. The quotes in "subjID" are
ASCII, and thus cause no problem.
Why am I getting a mix of UTF-8 and ASCII? Is it valid to mix UTF-8 and
ASCII in the same file? ... or is this an error? ... or is something
incorrect in my environment?
I am running Panther 10.3.9 on an iBook G4
> version
platform powerpc-apple-darwin7.9.0
arch powerpc
os darwin7.9.0
system powerpc, darwin7.9.0
status
major 2
minor 2.1
year 2005
month 12
day 20
svn rev 36812
language R
Ideas? Thanks in advance.
-Jim
--
E. James Nikelski, Ph.D.
Postdoctoral Research Fellow
Bloomfield Centre for Research in Aging
Lady Davis Institute for Medical Research
Sir Mortimer B. Davis - Jewish General Hospital
McGill University
More information about the R-SIG-Mac
mailing list