Output results to a single postscript document
Hi Pele,
I have been trying to output all my results (text, plots, etc) into the same postscript file...
Surely I missed something? Is it not simply that you are turning off the
postscript device in the wrong place? At the moment you only seem to be
using the postscript device in the plotting/chart function.
chart <- function(mod) {
postscript(file="fig.ps")
par(mfrow=c(2,1))
acf(residuals(mod))
pacf(residuals(mod))
dev.off() } ## don't turn it off here
Only turn it off when you have finished printing/plotting everything that
you want in it. You really do need to be more specific about what you have
in mind.
Regards, Mark.
Pele wrote:
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-tp21884901p21887202.html Sent from the R help mailing list archive at Nabble.com.