[R] Printing all output (text ans plots) to the same postscript document

Pele drdionc at yahoo.com
Sat Feb 7 04:57:04 CET 2009


Hello R users,

I have been trying to output all my results (text, plots, etc) into the same
postscript file as 

one document, but have been unable to...Can anyone help me improve my
simplified version of the code below so that I can accomplish this? 
Currently I have to output them separately then piece them back together
into one document..  

Thanks in Advance for any help!


options (scipen=999, digits=7)

library(foreign)
library(Hmisc)
library(prettyR)
library(DAAG)
library(lmtest)
library(car)
library(MASS)
library(nlme)
library(dyn)
library(wle)
library(lasso2)
library(zoo)

tdata <- ts(read.table("C:/MI_COE/Marketing
Mix/UK_Project/R_Code/testing/data.csv" ,sep = 

",",header=TRUE))
 print(tdata)

   res 	<- function(dep, indep, fn, env = parent.frame()) {
   depnm   	<- deparse(substitute(dep))
   indepnm 	<- deparse(substitute(indep))
        fo 	<- sprintf("%s ~ lag(%s, -1) + %s", depnm, depnm, indepnm)
        fo 	<- as.formula(fo, env = env)
        mod <- do.call(dyn$lm, list(fo))
        summ<- summary(mod)

	  chart <- function(mod) {
	  postscript(file="fig.ps")
   	  par(mfrow=c(2,1)) 
   	  acf(residuals(mod)) 
   	  pacf(residuals(mod)) 
   	  dev.off()                }
	  				                                  	
	  output  <- return(list(Summary=summ, Chart=chart(mod))) }
						
	  results <- res(tdata[ ,"Y"], tdata[ ,"X_VARY"]) ; results



-- 
View this message in context: http://www.nabble.com/Printing-all-output-%28text-ans-plots%29-to-the-same-postscript-document-tp21884853p21884853.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list