[R] Include "print" output into plots
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Sun Nov 24 13:29:07 CET 2002
Klaus.Thul at t-online.de (Klaus Thul) writes:
> Hello,
>
> I would like to set up some automatic reporting using R. For this purpose, I
> need to include the output of "print" commands into the graphics produced by
> some "plot" commands.
>
> 1. Is there an easy way to do this?
>
> 2. Is it possible to redirect "print" into a string?
> (except redirecting into a file and than scanning back?)
>
> 3. What is the best way to get a multi-line string printed into a plot window?
>
> Thanks in advance for any help.
Try this:
tc <- textConnection("txt",open="w")
sink(tc)
matrix(1:9,3)
sink()
close(tc)
plot(0,0)
text(-.5,.5,paste(txt,collapse="\n"))
Hmm,... It seems that we really could use a monospaced graphics font!
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list