I am an econometrics student using R-1.3.0 version for Linux. I have searched in all manuals but couldn?t find a most important iformation. Would you please be kind enough to give me some hints how do I print the output to a printer (not only to the screen). Is it the cat () instruction? The print() instruction places the output on the screen but does not send the output to the printer. ThankYou CJoseBento cjb at di.fct. -------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010628/a3f323f2/attachment.html
cjb <cjb at di.fct.unl.pt> writes:> I am an econometrics student using R-1.3.0 version for Linux. I have > searched in all manuals but couldn?t find a most important iformation. > > Would you please be kind enough to give me some hints how do I print the > output to a printer (not only to the screen). Is it the cat () > instruction? The print() instruction places the output on the screen but > does not send the output to the printer.You can use sink() on a connection like pipe("lpr") or pipe("enscript") depending on your setup. However, I usually realize that I want to print something only after seeing it on the screen and sink() requires you to plan ahead. Instead, I''d just fire up another window, enter the command that prints from stdin (e.g. enscript), copy and paste the relevant contents of the R window, and hit ctrl-D. (A good long scrollback on your terminal windows will be helpful.) If you use ESS (Emacs speaks statistics), then you simply handle the R buffer as an ordinary file and you can use the toplevel menu to "Print region", etc. -- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Please, I am an econometrics student using R. How do I print directly from R to a printer (not to the screen) : 1) an object saved previously in the workspace 2) a graphic plot on the screen Thank You CJBento UniNovaLisboa Portugal -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 am an econometrics student using R. How do I print directly from R to > a printer (not to the screen) : > > 1) an object saved previously in the workspace > 2) a graphic plot on the screen >Try this. If you give it an object name, it will print that object, otherwise it will print the current plot (assuming a Postscript printer): lpr <- function (object, file = "Rplotlpr.ps", ...) { if (missing(object)) { current.device <- dev.cur() dev.off(dev.copy(device = postscript, file = file, ...)) dev.set(current.device) system(paste("lpr", file)) print(paste(file, "printed.")) } else { if (missing(file)) file <- "Robjlpr.txt" sink(file) object <- as.character(substitute(object)) print(get(object)) sink() system(paste("lpr", file)) print(paste(object, "printed.")) } } Hope this helps, Ray Brownrigg <ray at mcs.vuw.ac.nz> http://www.mcs.vuw.ac.nz/~ray -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._