Hi, is there a reason that the quartz device does not like the "~" in file names, whereas most functions handling files (including pdf() ) have no problem with it? Thus pdf(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works pdf(file=~/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works quartz(file="~/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # does not work quartz(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works Cheers, Denis
saving files using quartz engine
4 messages · Denis Chabot, Brian Ripley, Ross.Darnell at csiro.au
16 days later
On Wed, 2 Nov 2011, Denis Chabot wrote:
Hi, is there a reason that the quartz device does not like the "~" in file names, whereas most functions handling files (including pdf() ) have no problem with it?
Yes. [Hint: no one contributed a patch for this wishlist item. The authors of mainstream graphics devices were generous enough to add tilde expansion: but you failed to thank them! Do remember that the people who gave you the gift of R are listening.] The author of pdf().
Thus pdf(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works pdf(file=~/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works quartz(file="~/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # does not work quartz(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works Cheers, Denis
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac
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
Are you sure the second case works? Ross Darnell
On 3/11/11 12:21 PM, "Denis Chabot" <chabot.denis at gmail.com> wrote:
Hi, is there a reason that the quartz device does not like the "~" in file names, whereas most functions handling files (including pdf() ) have no problem with it? Thus pdf(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works pdf(file=~/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works quartz(file="~/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # does not work quartz(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works Cheers, Denis
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Dear Ross, I apologize, there was careless cut and paste, I am sorry. And my message took long to appear on the list because I accidentally used an email address other than the one I subscribed with, so that it had to be cleared manually before it appeared. Thanks to the moderator for allowing it, by the way, and to you for pointing the error. I was a bit behind at the time (R 2.13.1, but 2.13.2 was out). I am way behind now, as I did not have time to upgrade to 2.14. I cannot be certain this is still an issue, but I would like to at least post a correct example. pdf(file="/Users/dchabot/Documents/Programmes R/test.pdf") # works plot(1:10) dev.off() pdf(file="~/Documents/Programmes R/test.pdf") # works plot(1:10) dev.off() quartz(file="~/Documents/Programmes R/test.pdf", type="pdf") # does not work plot(1:10) dev.off() quartz(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf") # works plot(1:10) dev.off() Only the 3rd example does not work:
quartz(file="~/Documents/Programmes R/test.pdf", type="pdf") # does not work
Erreur dans quartz(file = "~/Documents/Programmes R/test.pdf", type = "pdf") : Impossible de cr?er le p?riph?rique cible Quartz, le type fourni n'est peut-?tre pas support?.
plot(1:10) dev.off()
null device
1
Sat Nov 19 19:47:13 MBPi7Chabot.local R[389] <Error>: CGDataConsumerCreateWithFilename: failed to open `/Users/dchabot/~/Documents/Programmes R/test.pdf' for writing: No such file or directory.
deflateEnd: error -3: (null).
Sat Nov 19 19:47:13 MBPi7Chabot.local R[389] <Error>: CGPDFContextCreate: failed to create PDF context delegate.
In his reply to my post, Prof. Ripley said that tilde expansion had to be implemented into each graphics device. I did not know that, I thought it was built-in R because of its Unix roots. So I guess we now have the answer. It is not a big deal having to write the complete path, it just took me by surprise.
I would like to offer to add tilde expansion to quartz(), but I am not qualified to do so.
Denis
Le 2011-11-19 ? 16:35, <Ross.Darnell at csiro.au> <Ross.Darnell at csiro.au> a ?crit :
Are you sure the second case works? Ross Darnell On 3/11/11 12:21 PM, "Denis Chabot" <chabot.denis at gmail.com> wrote:
Hi, is there a reason that the quartz device does not like the "~" in file names, whereas most functions handling files (including pdf() ) have no problem with it? Thus pdf(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works pdf(file=~/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works quartz(file="~/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # does not work quartz(file="/Users/dchabot/Documents/Programmes R/test.pdf", type="pdf", width=6, height=5) # works Cheers, Denis
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac