You haven't given any of the information asked for in the posting guide.But, assuming this is Windows in CP1252 (as I believe that has been your locale before), it works for me in current R.
plot(1:10) file.label <- "foo" savePlot(paste("diagnostic â vs a ", file.label, ".jpg", sep = ""), type = "jpg") If you are not using 2.8.0 beta or 2.7.2 patched, please check those. This might be related to o file.path() did not work correctly in 2.7.0 if the components had different encodings. (NEWS for 2.7.1). On Sun, 5 Oct 2008, Charles Annis, P.E. wrote:
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. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com ______________________________________________ R-help@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.
-- Brian D. Ripley, [EMAIL PROTECTED] 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
______________________________________________ R-help@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.