Is there an easy way to "sink" text output to a pdf file using the pdf() device? Here's an email that describes setting up empty graphics plots and then using the "text" command to put text on page: http://www.r-project.org/nocvs/mail/r-help/2002/5598.html I'm just looking for something a little more polished -- automatic page breaks, line wrapping, etc. Kevin Wright, Research Scientist Pioneer Hi-Bred Int'l, x4054. http://www.DuPont.com/corp/email_disclaimer.html -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi, Kevin. In my view, the answer to your question depends, at least in part, on what you want to use the pdf file for. You may find that the conventional way of creating a pdf file with mixed text and graphics is to use LaTeX. You can then either output your graphics from R in LaTeX format, or write them directly to pdf, which you then import into your LaTeX document (a technique that seems to produce very nice results). You can then render your LaTeX document in pdf. To do publication-quality stuff, this is almost certainly your best bet. If your text consists of tabular information, you may be able to do something like: render the graphics into some convenient format such as png or jpg; output your tables in HTML; merge the two; render the lot into pdf. But you may struggle coming to the quality of rendering that publications would require. While your first effort may not satisfy your "easy" criteria, it gets better with experience. Regards, Mike On Fri, 2002-11-22 at 05:16, Wright, Kevin wrote:> Is there an easy way to "sink" text output to a pdf file using the pdf() > device? > > Here's an email that describes setting up empty graphics plots and then > using the "text" command to put text on page: > http://www.r-project.org/nocvs/mail/r-help/2002/5598.html > > I'm just looking for something a little more polished -- automatic page > breaks, line wrapping, etc. > > > Kevin Wright, Research Scientist > Pioneer Hi-Bred Int'l, x4054. > > > >Michael Nielsen ph: 0411-097-023 email: miken at bigpond.net.au Mike Nielsen ________________________________________________________________________ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hey all R-gurus, I'm trying to find a way to represent the "per mille" symbol in my axis labels. It looks like the percent sign but has two zeros in the denominator (in case I have the name wrong!) I took a look at example(Hershey) (which are delightful) but it wasn't there. Thanks for any suggestions! Andrew Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885 6226 University of Idaho E : andrewr at uidaho.edu PO Box 441133 W : http://www.uidaho.edu/~andrewr Moscow ID 83843 Or: http://www.biometrics.uidaho.edu No statement above necessarily represents my employer's opinion. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I guess I should have emphasize the word "easy" in the original post. I am aware of Sweave and have used it to produce terrific quality output, but it takes quite a bit of effort to get that quality (setting up tex document, erasing previous graphics, running the script, tex'ing the output, etc). HTML code with separate graphic images seems even more work. I was hoping for a non-presentation quality way to dump both graphics and text straight from R into pdf file using the pdf() device. Something akin to the way a Mathematica or Maple session looks like. Wouldn't it be nice, for example, to fit a linear model, then send both the residual plots and the anova table straight to the PDF file for easy storage in a single document? Doesn't need to need to be fancy. The idea of a Mathematica-style transcript session is quite appealing to me the more I think about it, but might be too-much work for the R community to create. Even the commercial software S-Plus lacks such reporting capabilities. Think--"summary" methods could produce text AND graphics--an intriguing idea. Kevin Wright> -----Original Message----- > From: Wright, Kevin > Sent: Thursday, November 21, 2002 12:16 PM > To: 'r-help at stat.math.ethz.ch' > Subject: Mixing text and graphics in PDF > > > Is there an easy way to "sink" text output to a pdf file > using the pdf() device? > > Here's an email that describes setting up empty graphics > plots and then using the "text" command to put text on page: > http://www.r-project.org/nocvs/mail/r-help/2002/5598.html > > I'm just looking for something a little more polished -- > automatic page breaks, line wrapping, etc. > > > Kevin Wright, Research Scientist > Pioneer Hi-Bred Int'l, x4054.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Here's something I hacked up a while ago to put a text box onto a figure. It uses a crude line-breaking algorithm. Hope it helps. Ben Bolker ## think about: justification etc. ## FIXME: specifying x length (and allowing it to be in inches or ## user parameters) would make putting text boxes on logarithmic ## scales much easier ... ## FIXME: resets par(adj) textbox <- function(x,y,textlist,justify=TRUE,cex=1, leading=0.5, box=TRUE) { ## basic strategy: break textlist into words, add words until ## length is right par(adj=0) textstr <- paste(textlist,collapse=" ") words <- strsplit(textstr," ")[[1]] line.height <- strheight("hy",cex=cex)*(1+leading) x.len <- diff(x) y.pos <- y x.pos <- x[1] curword <- 1 while (curword < length(words)) { curline <- "" ## add first word curline <- paste(curline,words[curword]) curword <- curword+1 while (x.pos+strwidth(paste(curline,words[curword]),cex=cex)<x[2]) { curline <- paste(curline,words[curword]) curword <- curword+1 } text(x.pos,y.pos,curline) y.pos <- y.pos - line.height } if (box) rect(x[1],y+line.height,x[2],y.pos) } On Thu, 21 Nov 2002, Wright, Kevin wrote:> > Is there an easy way to "sink" text output to a pdf file using the pdf() > device? > > Here's an email that describes setting up empty graphics plots and then > using the "text" command to put text on page: > http://www.r-project.org/nocvs/mail/r-help/2002/5598.html > > I'm just looking for something a little more polished -- automatic page > breaks, line wrapping, etc. > > > Kevin Wright, Research Scientist > Pioneer Hi-Bred Int'l, x4054. > > > > > This communication is for use by the intended recipient and contains > information that may be privileged, confidential or copyrighted under > applicable law. If you are not the intended recipient, you are hereby > formally notified that any use, copying or distribution of this e-mail, > in whole or in part, is strictly prohibited. Please notify the sender > by return e-mail and delete this e-mail from your system. Unless > explicitly and conspicuously designated as "E-Contract Intended", > this e-mail does not constitute a contract offer, a contract amendment, > or an acceptance of a contract offer. This e-mail does not constitute > a consent to the use of sender's contact information for direct marketing > purposes or for transfers of data to third parties. > > Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean > > http://www.DuPont.com/corp/email_disclaimer.html > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._