[R-SIG-Mac] Encoding issue with text output from R
marc_schwartz at me.com
Thu Jan 31 18:28:53 CET 2013
On Jan 31, 2013, at 11:17 AM, Fisher Dennis <fisher at plessthan.com> wrote:
> R 2.15.2
> OS X ML
> I am "sink"ing output from statistical tests to a text file:
> When I open the file with TextEdit, the output from lm() contains:
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> When I open the identical file in Word (2008), that same text appears as:
> Signif. codes: 0 ‚Äò***‚Äô 0.001 ‚Äò**‚Äô 0.01 ‚Äò*‚Äô 0.05 ‚Äò.‚Äô 0.1 ‚Äò ‚Äô 1
> When Word opens, it asks about the selection of encoding for the file. I tried a number of options and all lead to the same distorted text.
> Any idea how to resolve this (other than to ignore Word!)?
Looks like the directional quotes are messing you up.
Modify your code to use:
options(useFancyQuotes = FALSE)
before you use sink().
Also, you could use:
options(show.signif.stars = FALSE)
to suppress the inclusion of the significance stars, which I have in my .Rprofile file.
More information about the R-SIG-Mac