Hi, I have a set of script like this: ---------------------- summary(data) plot(time, users, type="o", xlab ="Time", ylab="Number of Users") ---------------------- I type "rterm --slave < script.r > output.doc" and the graphic doesn't actually in the output.doc file. How to make the graphic embedded in Word or Excel file? Thanks, Yu-Ling Wu __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Tue, 6 Mar 2001, Yu-Ling Wu wrote:> Hi, > > I have a set of script like this: > > ---------------------- > summary(data) > plot(time, users, type="o", xlab ="Time", ylab="Number > of Users") > ---------------------- > > I type "rterm --slave < script.r > output.doc" and the > graphic doesn't > actually in the output.doc file. How to make the > graphic embedded in Word > or Excel file?You need to write to a specified graphics device. That usage I believe just pops up a graphics window and shuts it again. I would think you want win.metafile("plot1.emf", width=??, height=??) before doing any plotting. Then you can include plot1.emf into a Word etc document. Note that the production of metafiles works much better in 1.2.2 than before. -- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Yu-Ling Wu <yuling5 at yahoo.com> writes:>Hi, > >I have a set of script like this: > >---------------------- >summary(data) >plot(time, users, type="o", xlab ="Time", ylab="Number >of Users") >---------------------- > >I type "rterm --slave < script.r > output.doc" and the >graphic doesn't >actually in the output.doc file. How to make the >graphic embedded in Word >or Excel file?I think you need to do to things: 1. In R use win.metafile() or something similar to store the plot in a file ... MS Office can handle a variety of formats but some may need to be installed. 2. Use a .VBA / .VBS script to automate Word / Excel to insert an object from a file. You can probable use system() to spark the .VBA script from within R. Mark -- Mark Myatt -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Yu-Ling Wu <yuling5 at yahoo.com> writes:>Thanks for your help. Now, I could write plots to >external files successfully. > >I am wondering if you could give me an example on >how to write a VB program to make Word do two things: >1. convert text into a table (dilimited by Tab) >2. insert a object/plot > >I know some VB but I'm kind of newbie to it.These are standard menu commands so the easiest way to get the right VB syntax would be to record a macro of these actions (Tools -> Macro -> Record). You can then see the code required by using Tools -> Macro -> Edit). You can then use the VBA help system for the keywords / commands. The above menu positions are for Word 7 (95). They may have changed in later versions. Mark>--- Mark Myatt <mark at myatt.demon.co.uk> wrote: >> Yu-Ling Wu <yuling5 at yahoo.com> writes: >> >Hi, >> > >> >I have a set of script like this: >> > >> >---------------------- >> >summary(data) >> >plot(time, users, type="o", xlab ="Time", >> ylab="Number >> >of Users") >> >---------------------- >> > >> >I type "rterm --slave < script.r > output.doc" and >> the >> >graphic doesn't >> >actually in the output.doc file. How to make the >> >graphic embedded in Word >> >or Excel file? >> >> I think you need to do to things: >> >> 1. In R use win.metafile() or something >> similar to store the >> plot in a file ... MS Office can handle a >> variety of formats but >> some may need to be installed. >> >> 2. Use a .VBA / .VBS script to automate Word >> / Excel to insert >> an object from a file. >> >> You can probable use system() to spark the .VBA >> script from within R.-- Mark Myatt -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._