[R] problem with source(), parse() and "french" colnames

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Nov 28 12:11:16 CET 2006


I am unable to reproduce this.  Note that source() makes use of 
options("encoding"), and that should be

> options("encoding")
$encoding
[1] "native.enc"

I do get a problem with e.g. source("foo.R", encoding="ASCII")

If that is not the problem, please produce a small reproducible example 
that fails when run with Rterm.exe --vanilla. As the footer of every 
message says:

> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

(and that asks you not to send HTML mail).


On Tue, 28 Nov 2006, Pascal Boisson wrote:

> Hello every one
>
> Working under Windows Xp in French, and R version 2.4.0 (and : >
> localeToCharset()  :  "ISO8859-1" )
> I am trying to source a file with basic commands.
>
> source("R files/InputFile Analysis (Calculs et mises à l'échelle - gestion
> des pb d'unités).r")
>
> and it works fine as long as I do not use command like these ones :
>
> file_table[[2]]$MES.boue.recirculée.autosurveillance   <-
> 1000*file_table[[2]]$MES.boue.recirculée.autosurveillance
> file_table[[2]]$MES.boue.recirculée.en.continu           <-
> 1000*file_table[[2]]$MES.boue.recirculée.en.continu
>
> These commands work perfectly when used individually and submitted directly.
> But when I am sourcing the command file including these lines, I get the
> following error message :
>
> Erreur dans parse(file, n = -1, NULL, "?") : erreur de syntaxe à la ligne
> 35: MES.liqueur.mixte.en.continu<-
> 1000*file_table[[2]]$MES.liqueur.mixte.en.continu
> 36:     file_table[[2]]$MES.boue.recircul‚
>
> I guess that the problem is coming form the "é" in my colnames as the
> following command :
>
> file_table[[2]]$MES.liqueur.mixte.autosurveillance<-
> 1000*file_table[[2]]$MES.liqueur.mixte.autosurveillance
>
> works fine, even when sourced ...
>
> My colnames are make.names() output, and I am wondering how to set up things
> to allow "é" in sourced commands (or enventually to transform "é" in "e"
> with mae.names).
> Does any body know how ?
>
> Thanks, and sincerely yours,
>
> Pascal Boisson
>
> 	[[alternative HTML version deleted]]
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list