[R] Encoding of Sweave file error message

Duncan Mackay mackay at northnet.com.au
Thu Apr 12 14:50:53 CEST 2012


Hi Duncan

Thank you for the tips

I tried

\usepackage[latin1]{inputenc}

but it still bailed up.

tried showNonASCII on the file with the ° typed 
as Alt-248 (used to doing as DOS value)
becomes Alt-176 in ASCII

% 1° line
resulted in
483: % 1<b0> line

The showNonASCII is a nifty function

Duncan


At 22:32 12/04/2012, you wrote:
>On 12-04-12 12:13 AM, Duncan Mackay wrote:
>>
>>
>>At 12:03 12/04/2012, you wrote:
>>>I had the same problem! So, as I'm a linux user,
>>>I prefer use linux terminal. On terminal I type this to compile
>>>
>>>R CMD Sweave --encoding=utf-8 myfile.Rnw
>>>
>>>and the compilation is successful. Try to set 
>>>the encoding option in Sweave().
>>>
>>>Bests.
>>>Walmes.
>>>
>>>==========================================================================
>>>Walmes Marques Zeviani
>>>LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)
>>>Departamento de Estatística - Universidade Federal do Paraná
>>>fone: (+55) 41 3361 3573
>>>VoIP: (3361 3600) 1053 1173
>>>e-mail:<mailto:walmes at ufpr.br>walmes at ufpr.br
>>>twitter: @walmeszeviani
>>>homepage:<http://www.leg.ufpr.br/%7Ewalmes>http://www.leg.ufpr.br/~walmes
>>>linux user number: 531218
>>>==========================================================================
>>
>>Hi Walmes
>>
>>Thank you very much. That appears to be the problem.
>>When I typed from the DOS terminal
>>
>>R CMD Sweave --encoding=utf-8 ParasiteComb12.Rnw
>>
>>it compiled the tex file without any error messages.
>>
>>I have not really got into font encoding and
>>reading the Sweave manual I thought that what I had done would be sufficient.
>>
>>I found an old note which gave a reference to
>>http://tolstoy.newcastle.edu.au/R/e10/help/10/05/4725.html
>>http://tolstoy.newcastle.edu.au/R/e10/help/10/05/4889.html
>>but that appears to be specific.
>>
>>The ?Sweave and the Sweave manual appear to be
>>more specific about the latex side.
>>
>>After having a look at iconvlist()  and bearing
>>in mind Duncan Murdoch's comments about windows I tried
>>
>>Sweave("D:/Cic/Sweave/Parasite/Comb/12/ParasiteComb12.Rnw",
>>encoding = "UTF-8")
>>
>>from the Rgui command window and compiled without any problems
>>When I had a look at the tex file there were a
>>few DOS Alt-248 (degree symbol ) within latex
>>comments which were added last running R2.14 before updating
>
>That doesn't sound like UTF-8 encoding, it 
>sounds like Latin-1.  So declaring it to be 
>UTF-8 will eventually cause you some problems, 
>when you put some of those characters in a place 
>that LaTeX processes.  You can avoid the problem 
>by putting this line in your Rnw file:
>
>\usepackage[latin1]{inputenc}
>
>as the ?Sweave help page says.  Or, just delete 
>those non-ASCII characters.  There's a function 
>in the tools package to detect them: see ?tools::showNonASCII.
>
>Duncan Murdoch
>
>
>>
>>Removing them and re running without the encoding
>>argument brought things back to normal.
>>
>>I tried as a test
>>\SweaveOpts{encoding="UTF8"}
>>but that appears not to work
>>
>>All I have to do now is to put the extra argument
>>into my text editors clip library for Sweave for
>>next time when I cannot solve things.
>>Its been a long week !
>>
>>Regards
>>
>>Duncan
>>
>>
>>Duncan Mackay
>>Department of Agronomy and Soil Science
>>University of New England
>>ARMIDALE NSW 2351
>>Email home: mackay at northnet.com.au
>>
>>
>>
>>
>>
>>         [[alternative HTML version deleted]]
>>
>>
>>
>>
>>______________________________________________
>>R-help at r-project.org mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list