[R] Output results to a single postscript document

Pele drdionc at yahoo.com
Sat Feb 7 05:07:29 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 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:/tmp/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/Output-results-to-a-single-postscript-document-tp21884901p21884901.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list