[R] PDF Corrupted?

2009-10-27 Thread rkevinburton
I am running R 2.9.2 and creating a PDF that I am trying to open with Adobe 
Reader 9.2 but when I try to open it the reader responds with 

There was an error opening this document. The file is damaged and cannot be 
repaired.:

I am using the R command(s):

pdf(file=cat.pdf, title=Historical Sales By Category)
for(j in 1:length(master))
{
d - as.Date(master[[j]]$Period[1], format=%m/%d/%Y)
fit - ets(ts(master[[j]]$Quantity, start=c(1900 + as.POSIXlt(d)$year, 1 + 
as.POSIXlt(d)$mon), frequency=12))
plot(fit, col.axis = sky blue, col.lab = thistle)
title(master[[j]]$Category,
  cex.main = 2,   font.main= 4, col.main= blue)
}

Any idea what I am doing wrong?

Thank you.

Kevin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] PDF Corrupted?

2009-10-27 Thread Marc Schwartz


On Oct 27, 2009, at 7:42 PM, rkevinbur...@charter.net wrote:

I am running R 2.9.2 and creating a PDF that I am trying to open  
with Adobe Reader 9.2 but when I try to open it the reader responds  
with


There was an error opening this document. The file is damaged and  
cannot be repaired.:


I am using the R command(s):

pdf(file=cat.pdf, title=Historical Sales By Category)
for(j in 1:length(master))
{
   d - as.Date(master[[j]]$Period[1], format=%m/%d/%Y)
   fit - ets(ts(master[[j]]$Quantity, start=c(1900 + as.POSIXlt(d) 
$year, 1 + as.POSIXlt(d)$mon), frequency=12))

   plot(fit, col.axis = sky blue, col.lab = thistle)
   title(master[[j]]$Category,
 cex.main = 2,   font.main= 4, col.main= blue)
}

Any idea what I am doing wrong?

Thank you.

Kevin




You are not closing the PDF file with dev.off() when you are done  
plotting...


HTH,

Marc Schwartz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] PDF Corrupted?

2009-10-27 Thread Bryan Hanson
Looks like you need to do dev.off() after the plot to properly close the
file.

Bryan
*
Bryan Hanson
Acting Chair
Professor of Chemistry  Biochemistry
DePauw University, Greencastle IN USA



On 10/27/09 8:42 PM, rkevinbur...@charter.net rkevinbur...@charter.net
wrote:

 I am running R 2.9.2 and creating a PDF that I am trying to open with Adobe
 Reader 9.2 but when I try to open it the reader responds with
 
 There was an error opening this document. The file is damaged and cannot be
 repaired.:
 
 I am using the R command(s):
 
 pdf(file=cat.pdf, title=Historical Sales By Category)
 for(j in 1:length(master))
 {
 d - as.Date(master[[j]]$Period[1], format=%m/%d/%Y)
 fit - ets(ts(master[[j]]$Quantity, start=c(1900 + as.POSIXlt(d)$year, 1 +
 as.POSIXlt(d)$mon), frequency=12))
 plot(fit, col.axis = sky blue, col.lab = thistle)
 title(master[[j]]$Category,
   cex.main = 2,   font.main= 4, col.main= blue)
 }
 
 Any idea what I am doing wrong?
 
 Thank you.
 
 Kevin
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] PDF Corrupted?

2009-10-27 Thread Jorge Ivan Velez
Hi Kevin,

Close the device once the plot is completed:

pdf(...)
plots go here
dev.off()

HTH,
Jorge

On Tue, Oct 27, 2009 at 8:42 PM,  wrote:

 I am running R 2.9.2 and creating a PDF that I am trying to open with Adobe
 Reader 9.2 but when I try to open it the reader responds with

 There was an error opening this document. The file is damaged and cannot
 be repaired.:

 I am using the R command(s):

 pdf(file=cat.pdf, title=Historical Sales By Category)
 for(j in 1:length(master))
 {
d - as.Date(master[[j]]$Period[1], format=%m/%d/%Y)
fit - ets(ts(master[[j]]$Quantity, start=c(1900 + as.POSIXlt(d)$year, 1
 + as.POSIXlt(d)$mon), frequency=12))
plot(fit, col.axis = sky blue, col.lab = thistle)
title(master[[j]]$Category,
  cex.main = 2,   font.main= 4, col.main= blue)
 }

 Any idea what I am doing wrong?

 Thank you.

 Kevin

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] PDF Corrupted?

2009-10-27 Thread Simon Blomberg
Try doing dev.off() after you finish the plot. That will close the
device and should make it available for viewing.

Cheers,

Simon.

On Tue, 2009-10-27 at 17:42 -0700, rkevinbur...@charter.net wrote:
 I am running R 2.9.2 and creating a PDF that I am trying to open with Adobe 
 Reader 9.2 but when I try to open it the reader responds with 
 
 There was an error opening this document. The file is damaged and cannot be 
 repaired.:
 
 I am using the R command(s):
 
 pdf(file=cat.pdf, title=Historical Sales By Category)
 for(j in 1:length(master))
 {
 d - as.Date(master[[j]]$Period[1], format=%m/%d/%Y)
 fit - ets(ts(master[[j]]$Quantity, start=c(1900 + as.POSIXlt(d)$year, 1 
 + as.POSIXlt(d)$mon), frequency=12))
 plot(fit, col.axis = sky blue, col.lab = thistle)
 title(master[[j]]$Category,
   cex.main = 2,   font.main= 4, col.main= blue)
 }
 
 Any idea what I am doing wrong?
 
 Thank you.
 
 Kevin
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
School of Biological Sciences
The University of Queensland 
St. Lucia Queensland 4072 
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

Statistics is the grammar of science - Karl Pearson

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] PDF Corrupted?

2009-10-27 Thread p_connolly

Quoting rkevinbur...@charter.net:

I am running R 2.9.2 and creating a PDF that I am trying to open with 
Adobe Reader 9.2 but when I try to open it the reader responds with


There was an error opening this document. The file is damaged and 
cannot be repaired.:


I am using the R command(s):

pdf(file=cat.pdf, title=Historical Sales By Category)
for(j in 1:length(master))
{
d - as.Date(master[[j]]$Period[1], format=%m/%d/%Y)
fit - ets(ts(master[[j]]$Quantity, start=c(1900 + 
as.POSIXlt(d)$year, 1 + as.POSIXlt(d)$mon), frequency=12))

plot(fit, col.axis = sky blue, col.lab = thistle)
title(master[[j]]$Category,
  cex.main = 2,   font.main= 4, col.main= blue)
}

Any idea what I am doing wrong?


try dev.off() at the end.  Yous is an FAQ.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.