A patch for extending pdf device to embed popup text and web links
Dear Paul and Tobias, Thank you for your positive comments. I agree your comments. Firstly, I am learning how to make an R package, and RSVGTipsDevice is a good pointer for me. Secondly, in a package of extended pdf device, I will try to follow the R coding style. For example, text and mtext functions will be overwritten to accept "href" and "popup" options. Then, we extend the functions simply and can keep compatibility. This is also possible for rect function. In short, we don't have to have any new functions! Regards, Tadashi Kadowaki 2008/5/5 Paul Murrell <p.murrell at auckland.ac.nz>:
Hi Tobias Verbeke wrote:
> Dear Tadashi, > > Thank you very much for sharing your work. >
>> I am sending a patch for R-2.7.0 for extending pdf device to embed pop >> up text and >> web links. The patch is available at >> http://www.okada.jp.org/RWiki/?plugin=attach&pcmd=open&file=R-2.7.0.patch&refer=pdf%20device%20patch >> You can see what the patch can do through a sample output, which is available at >> http://www.okada.jp.org/RWiki/?plugin=attach&pcmd=open&file=sample2.pdf&refer=pdf%20device%20patch >> An script is at >> http://www.okada.jp.org/RWiki/?plugin=attach&pcmd=open&file=sample2.r&refer=pdf%20device%20patch >> >> Ei-ji Nakama kindly build Windows binary, which can be obtained from >> http://prs.ism.ac.jp/~nakama/tadakadosan/cran/ >> An installer, R-2.7.0pat-win32.exe, will install programs in >> C:\Program Files\R\R-2.7.0pat >> so that you can use both of original and patched version simultaneously.
> > I think it would be most useful if you could bundle your patched version > of the pdf device in a separate device package, similar to the > RSVGTipsDevice.
I would second that approach, at least in the meantime. This sort of
functionality is interesting and useful, but needs careful thought to
make it compatible with the existing graphics facilities in R.
One major consideration is that the graphics system tries to be mostly
device-independent, so that R graphics code can be run on any device.
This would need adjustments to the common graphics engine/device C code
rather than just to the C code underlying the PDF device.
There is also the issue of following standard R coding style and
semantics. Rather than your approach of ...
text(5, 2, "text test")
pdf.link.on.text("http://www.google.com")
... where the second call relies on a global setting to relate to the
appropriate text, it would be better to have something like ...
linkedText(5, 2, "text test", href="http://www.google.com")
... so that the association is explicit.
By developing your ideas as an add-on package, people can try out your
ideas without having to recompile R. As Tobias has pointed out, the
RSVGTipsDevice package might be a good place to start.
Paul
> What do you think ? > > Kind regards, > Tobias > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/