[R] trouble with character \u00e2

Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com
Sun Oct 5 21:51:04 CEST 2008


Greetings R-wizards:

For historical reasons I have filenames with the character "â" and have
successfully used "\u00e2" in its place, with the hoped-for result on all my
on-screen plots.

However since R2.7.0 I have trouble with savePlot() when the file name
includes that character as it does in this example:

savePlot(paste("diagnostic â vs a ", file.label, ".jpg", 
        sep = ""), type = "jpg")

In R2.6.0 and earlier, R would ignore a dot ('.') in the file name and
supply the extension.  Since R2.7.0 if filename does include a dot,
savePlot() will  not add the file type as an extension.  Thus my apparent
redundancy in the file name.

The problem I have is that the example command will substitute an unwanted
character for â, yet if I use "File, save as, jpg ... " and type in a name
containing the troublesome character, R saves the on-screen plot with that
character in the name with no complaints.

I have tried using iconv() with no success, as can be seen with the
following code:

file.name <- paste("diagnostic â vs a ", file.label, ".jpg", sep = "")

iconv.List <- iconvlist()

for(encoding in iconv.List) {

print(iconv(file.name, "", encoding, ""))}

So, here's the question:  How can I save, with a non-interactive R command,
an existing plot with the troublesome character in the file name?

Thanks.



Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 



More information about the R-help mailing list