Re: [R] Compress (gzip) a pdf device

2009-10-02 Thread Rainer M Krug
On Thu, Oct 1, 2009 at 7:26 PM, Martin Renner 
martin.ren...@stonebow.otago.ac.nz wrote:

 try pdftk. Not quite on the fly but should do the trick. (I saw this on
 this list a little while ago)


pdftk compresses the pdf internally - it is still a pdf, can be opened as a
pdf, and is not an externally compressed pdf (pdf in an archive).
Below is the approach which I am using, but as stated earlier, if somebody
could provide a way of only doing dev.off() whhich then calls pdfComp() with
the filename, I would be glad to know. Otherwise.

Rainer



 pdfComp - function (pdfname){
  if (0){
x - tempfile()
system (paste (mv, pdfname, x))
system (paste (pdftk, x, output, pdfname, compress))
unlink (x)
  }
 }

 pdf (test.pdf)
 plot (1:10)
 dev.off()
 pdfComp (test.pdf)


 On 30 Sep 2009, at 00:25 , Rainer M Krug wrote:

  2009/9/30 Daniele Amberti daniele.ambe...@ors.it

  I have not found an easy way to compress a file on filesystem.
 Especially I'd like to compress a pdf from pdf() function/device. Is it
 possible to compress It on the flight?
 I'd like to do something like:
 pdf(gzipconnection())
 dev.off()


  I guess this boils down to a question I asked some time ago concerning
 getting the filename of a pdf() device, as I wanted to create a compressed
 pdf from the uncompressed pdf created by R (not zipping the pdf).
 It does not seem to be possible, at least I did not get any response which
 I
 could use to implement my idea (create my dev.off(), which calls dev.off()
 and afterwards compresses the pdf by using the file name).

 If you find a solution, please let me know.

 Cheers,

 Rainer

 If It is not possible, how can I create a gzip with the pdf?


 Thanks
 Daniele A.



 
 ORS Srl

 Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
 Tel. +39 0173 620211
 Fax. +39 0173 620299 / +39 0173 433111
 Web Site www.ors.it



 
 Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi
 allegati ? vietato e potrebbe costituire reato.
 Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se
 provvedesse alla distruzione dello stesso
 e degli eventuali allegati.
 Opinioni, conclusioni o altre informazioni riportate nella e-mail, che
 non
 siano relative alle attivit? e/o
 alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla
 societ? stessa, n? la impegnano in alcun modo.

  [[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.




 --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology,
 UCT), Dipl. Phys. (Germany)

 Centre of Excellence for Invasion Biology
 Natural Sciences Building
 Office Suite 2039
 Stellenbosch University
 Main Campus, Merriman Avenue
 Stellenbosch
 South Africa

 Cell:   +27 - (0)83 9479 042
 Fax:+27 - (0)86 516 2782
 Fax:+49 - (0)721 151 334 888
 email:  rai...@krugs.de

 Skype:  RMkrug
 Google: r.m.k...@gmail.com

[[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.





-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[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] Compress (gzip) a pdf device

2009-10-02 Thread Gábor Csárdi
Rainer,

if you are willing to patch the R source, then a solution might be the
R connection patch, see
http://wiki.r-project.org/rwiki/doku.php?id=developers:r_connections_api
It is a bit outdated, but with a little work I could use it for R
2.9.2 and works fine.

Best,
Gabor

On Fri, Oct 2, 2009 at 8:54 AM, Rainer M Krug r.m.k...@gmail.com wrote:
 On Thu, Oct 1, 2009 at 7:26 PM, Martin Renner 
 martin.ren...@stonebow.otago.ac.nz wrote:

 try pdftk. Not quite on the fly but should do the trick. (I saw this on
 this list a little while ago)


 pdftk compresses the pdf internally - it is still a pdf, can be opened as a
 pdf, and is not an externally compressed pdf (pdf in an archive).
 Below is the approach which I am using, but as stated earlier, if somebody
 could provide a way of only doing dev.off() whhich then calls pdfComp() with
 the filename, I would be glad to know. Otherwise.

 Rainer



 pdfComp - function (pdfname){
  if (0){
    x - tempfile()
    system (paste (mv, pdfname, x))
    system (paste (pdftk, x, output, pdfname, compress))
    unlink (x)
  }
 }

 pdf (test.pdf)
 plot (1:10)
 dev.off()
 pdfComp (test.pdf)


 On 30 Sep 2009, at 00:25 , Rainer M Krug wrote:

  2009/9/30 Daniele Amberti daniele.ambe...@ors.it

  I have not found an easy way to compress a file on filesystem.
 Especially I'd like to compress a pdf from pdf() function/device. Is it
 possible to compress It on the flight?
 I'd like to do something like:
 pdf(gzipconnection())
 dev.off()


  I guess this boils down to a question I asked some time ago concerning
 getting the filename of a pdf() device, as I wanted to create a compressed
 pdf from the uncompressed pdf created by R (not zipping the pdf).
 It does not seem to be possible, at least I did not get any response which
 I
 could use to implement my idea (create my dev.off(), which calls dev.off()
 and afterwards compresses the pdf by using the file name).

 If you find a solution, please let me know.

 Cheers,

 Rainer

 If It is not possible, how can I create a gzip with the pdf?


 Thanks
 Daniele A.



 
 ORS Srl

 Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
 Tel. +39 0173 620211
 Fax. +39 0173 620299 / +39 0173 433111
 Web Site www.ors.it



 
 Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi
 allegati ? vietato e potrebbe costituire reato.
 Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se
 provvedesse alla distruzione dello stesso
 e degli eventuali allegati.
 Opinioni, conclusioni o altre informazioni riportate nella e-mail, che
 non
 siano relative alle attivit? e/o
 alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla
 societ? stessa, n? la impegnano in alcun modo.

      [[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.




 --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology,
 UCT), Dipl. Phys. (Germany)

 Centre of Excellence for Invasion Biology
 Natural Sciences Building
 Office Suite 2039
 Stellenbosch University
 Main Campus, Merriman Avenue
 Stellenbosch
 South Africa

 Cell:           +27 - (0)83 9479 042
 Fax:            +27 - (0)86 516 2782
 Fax:            +49 - (0)721 151 334 888
 email:          rai...@krugs.de

 Skype:          RMkrug
 Google:         r.m.k...@gmail.com

        [[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.





 --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
 UCT), Dipl. Phys. (Germany)

 Centre of Excellence for Invasion Biology
 Natural Sciences Building
 Office Suite 2039
 Stellenbosch University
 Main Campus, Merriman Avenue
 Stellenbosch
 South Africa

 Cell:           +27 - (0)83 9479 042
 Fax:            +27 - (0)86 516 2782
 Fax:            +49 - (0)721 151 334 888
 email:          rai...@krugs.de

 Skype:          RMkrug
 Google:         r.m.k...@gmail.com

        [[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.




-- 
Gabor Csardi gabor.csa...@unil.ch UNIL DGM

__
R-help@r-project.org mailing list

Re: [R] Compress (gzip) a pdf device

2009-10-02 Thread Rainer M Krug
On Fri, Oct 2, 2009 at 9:02 AM, Gábor Csárdi csa...@rmki.kfki.hu wrote:

 Rainer,

 if you are willing to patch the R source, then a solution might be the
 R connection patch, see
 http://wiki.r-project.org/rwiki/doku.php?id=developers:r_connections_api
 It is a bit outdated, but with a little work I could use it for R
 2.9.2 and works fine.


Thanks - I will look into it and give feedback as soon as I have done.

Cheers,

Rainer



 Best,
 Gabor

 On Fri, Oct 2, 2009 at 8:54 AM, Rainer M Krug r.m.k...@gmail.com wrote:
  On Thu, Oct 1, 2009 at 7:26 PM, Martin Renner 
  martin.ren...@stonebow.otago.ac.nz wrote:
 
  try pdftk. Not quite on the fly but should do the trick. (I saw this on
  this list a little while ago)
 
 
  pdftk compresses the pdf internally - it is still a pdf, can be opened as
 a
  pdf, and is not an externally compressed pdf (pdf in an archive).
  Below is the approach which I am using, but as stated earlier, if
 somebody
  could provide a way of only doing dev.off() whhich then calls pdfComp()
 with
  the filename, I would be glad to know. Otherwise.
 
  Rainer
 
 
 
  pdfComp - function (pdfname){
   if (0){
 x - tempfile()
 system (paste (mv, pdfname, x))
 system (paste (pdftk, x, output, pdfname, compress))
 unlink (x)
   }
  }
 
  pdf (test.pdf)
  plot (1:10)
  dev.off()
  pdfComp (test.pdf)
 
 
  On 30 Sep 2009, at 00:25 , Rainer M Krug wrote:
 
   2009/9/30 Daniele Amberti daniele.ambe...@ors.it
 
   I have not found an easy way to compress a file on filesystem.
  Especially I'd like to compress a pdf from pdf() function/device. Is
 it
  possible to compress It on the flight?
  I'd like to do something like:
  pdf(gzipconnection())
  dev.off()
 
 
   I guess this boils down to a question I asked some time ago
 concerning
  getting the filename of a pdf() device, as I wanted to create a
 compressed
  pdf from the uncompressed pdf created by R (not zipping the pdf).
  It does not seem to be possible, at least I did not get any response
 which
  I
  could use to implement my idea (create my dev.off(), which calls
 dev.off()
  and afterwards compresses the pdf by using the file name).
 
  If you find a solution, please let me know.
 
  Cheers,
 
  Rainer
 
  If It is not possible, how can I create a gzip with the pdf?
 
 
  Thanks
  Daniele A.
 
 
 
  
  ORS Srl
 
  Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
  Tel. +39 0173 620211
  Fax. +39 0173 620299 / +39 0173 433111
  Web Site www.ors.it
 
 
 
 
 
  Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi
  allegati ? vietato e potrebbe costituire reato.
  Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati
 se
  provvedesse alla distruzione dello stesso
  e degli eventuali allegati.
  Opinioni, conclusioni o altre informazioni riportate nella e-mail, che
  non
  siano relative alle attivit? e/o
  alla missione aziendale di O.R.S. Srl si intendono non attribuibili
 alla
  societ? stessa, n? la impegnano in alcun modo.
 
   [[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.
 
 
 
 
  --
  Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
  Biology,
  UCT), Dipl. Phys. (Germany)
 
  Centre of Excellence for Invasion Biology
  Natural Sciences Building
  Office Suite 2039
  Stellenbosch University
  Main Campus, Merriman Avenue
  Stellenbosch
  South Africa
 
  Cell:   +27 - (0)83 9479 042
  Fax:+27 - (0)86 516 2782
  Fax:+49 - (0)721 151 334 888
  email:  rai...@krugs.de
 
  Skype:  RMkrug
  Google: r.m.k...@gmail.com
 
 [[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.
 
 
 
 
 
  --
  Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology,
  UCT), Dipl. Phys. (Germany)
 
  Centre of Excellence for Invasion Biology
  Natural Sciences Building
  Office Suite 2039
  Stellenbosch University
  Main Campus, Merriman Avenue
  Stellenbosch
  South Africa
 
  Cell:   +27 - (0)83 9479 042
  Fax:+27 - (0)86 516 2782
  Fax:+49 - (0)721 151 334 888
  email:  rai...@krugs.de
 
  Skype:  RMkrug
  Google: r.m.k...@gmail.com
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing 

Re: [R] Compress (gzip) a pdf device - [ ] Message is from an unknown sender

2009-10-01 Thread Daniele Amberti
By now It seems nobody have idea.

zz - gzfile(C:/gzpdftest.gz, wb)
pdf(file = zz)
plot(USArrests)
dev.off()
close(zz)

produce a file named 3 without any extension in my working directory.

Also I don't have any news on how to gzip the pdf afterward (without using an 
external executable).

Daniele


From: Rainer M Krug [mailto:r.m.k...@gmail.com]
Sent: 30 September 2009 10:26
To: Daniele Amberti
Cc: r-help@r-project.org
Subject: Re: [R] Compress (gzip) a pdf device - [ ] Message is from an unknown 
sender


2009/9/30 Daniele Amberti 
daniele.ambe...@ors.itmailto:daniele.ambe...@ors.it
I have not found an easy way to compress a file on filesystem.
Especially I'd like to compress a pdf from pdf() function/device. Is it 
possible to compress It on the flight?
I'd like to do something like:
pdf(gzipconnection())
dev.off()

I guess this boils down to a question I asked some time ago concerning getting 
the filename of a pdf() device, as I wanted to create a compressed pdf from the 
uncompressed pdf created by R (not zipping the pdf).
It does not seem to be possible, at least I did not get any response which I 
could use to implement my idea (create my dev.off(), which calls dev.off() and 
afterwards compresses the pdf by using the file name).

If you find a solution, please let me know.

Cheers,

Rainer
If It is not possible, how can I create a gzip with the pdf?

Thanks
Daniele A.








ORS Srl

Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
Tel. +39 0173 620211
Fax. +39 0173 620299 / +39 0173 433111
Web Site www.ors.it


Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi allegati ? 
vietato e potrebbe costituire reato.
Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se 
provvedesse alla distruzione dello stesso
e degli eventuali allegati.
Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non 
siano relative alle attivit? e/o
alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla 
societ? stessa, n? la impegnano in alcun modo.

[[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] Compress (gzip) a pdf device - [ ] Message is from an unknown sender

2009-10-01 Thread Ista Zahn
I guess I don't understand what your're trying to do. gzip-ing a file
from within R is easy enough:

pdf(file=CompressMe.pdf)
plot(rnorm(100))
dev.off()
system(gzip CompressMe.pdf)

I think you want something more complicated, but I'm not sure what.

-Ista

On Thu, Oct 1, 2009 at 6:41 AM, Daniele Amberti daniele.ambe...@ors.it wrote:
 By now It seems nobody have idea.

 zz - gzfile(C:/gzpdftest.gz, wb)
 pdf(file = zz)
 plot(USArrests)
 dev.off()
 close(zz)

 produce a file named 3 without any extension in my working directory.

 Also I don't have any news on how to gzip the pdf afterward (without using an 
 external executable).

 Daniele


 From: Rainer M Krug [mailto:r.m.k...@gmail.com]
 Sent: 30 September 2009 10:26
 To: Daniele Amberti
 Cc: r-help@r-project.org
 Subject: Re: [R] Compress (gzip) a pdf device - [ ] Message is from an 
 unknown sender


 2009/9/30 Daniele Amberti 
 daniele.ambe...@ors.itmailto:daniele.ambe...@ors.it
 I have not found an easy way to compress a file on filesystem.
 Especially I'd like to compress a pdf from pdf() function/device. Is it 
 possible to compress It on the flight?
 I'd like to do something like:
 pdf(gzipconnection())
 dev.off()

 I guess this boils down to a question I asked some time ago concerning 
 getting the filename of a pdf() device, as I wanted to create a compressed 
 pdf from the uncompressed pdf created by R (not zipping the pdf).
 It does not seem to be possible, at least I did not get any response which I 
 could use to implement my idea (create my dev.off(), which calls dev.off() 
 and afterwards compresses the pdf by using the file name).

 If you find a solution, please let me know.

 Cheers,

 Rainer
 If It is not possible, how can I create a gzip with the pdf?

 Thanks
 Daniele A.



 



 
 ORS Srl

 Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
 Tel. +39 0173 620211
 Fax. +39 0173 620299 / +39 0173 433111
 Web Site www.ors.it

 
 Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi allegati 
 ? vietato e potrebbe costituire reato.
 Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se 
 provvedesse alla distruzione dello stesso
 e degli eventuali allegati.
 Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non 
 siano relative alle attivit? e/o
 alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla 
 societ? stessa, n? la impegnano in alcun modo.

        [[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.




-- 
Ista Zahn
Graduate student
University of Rochester
http://yourpsyche.org

__
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] Compress (gzip) a pdf device - [ ] Message is from an unknown sender

2009-10-01 Thread Daniele Amberti
system() invokes the OS command specified by command, in the example you gave 
it means that gzip is installed and (assuming Windows OS) it is in your search 
path.

I'd like to have a solution that do not use external programs.

Thanks
Daniele

-Original Message-
From: Ista Zahn [mailto:istaz...@gmail.com]
Sent: 01 October 2009 17:11
To: Daniele Amberti
Cc: r-help@r-project.org; Rainer M Krug
Subject: Re: [R] Compress (gzip) a pdf device - [ ] Message is from an unknown 
sender

I guess I don't understand what your're trying to do. gzip-ing a file
from within R is easy enough:

pdf(file=CompressMe.pdf)
plot(rnorm(100))
dev.off()
system(gzip CompressMe.pdf)

I think you want something more complicated, but I'm not sure what.

-Ista

On Thu, Oct 1, 2009 at 6:41 AM, Daniele Amberti daniele.ambe...@ors.it wrote:
 By now It seems nobody have idea.

 zz - gzfile(C:/gzpdftest.gz, wb)
 pdf(file = zz)
 plot(USArrests)
 dev.off()
 close(zz)

 produce a file named 3 without any extension in my working directory.

 Also I don't have any news on how to gzip the pdf afterward (without using an 
 external executable).

 Daniele


 From: Rainer M Krug [mailto:r.m.k...@gmail.com]
 Sent: 30 September 2009 10:26
 To: Daniele Amberti
 Cc: r-help@r-project.org
 Subject: Re: [R] Compress (gzip) a pdf device - [ ] Message is from an 
 unknown sender


 2009/9/30 Daniele Amberti 
 daniele.ambe...@ors.itmailto:daniele.ambe...@ors.it
 I have not found an easy way to compress a file on filesystem.
 Especially I'd like to compress a pdf from pdf() function/device. Is it 
 possible to compress It on the flight?
 I'd like to do something like:
 pdf(gzipconnection())
 dev.off()

 I guess this boils down to a question I asked some time ago concerning 
 getting the filename of a pdf() device, as I wanted to create a compressed 
 pdf from the uncompressed pdf created by R (not zipping the pdf).
 It does not seem to be possible, at least I did not get any response which I 
 could use to implement my idea (create my dev.off(), which calls dev.off() 
 and afterwards compresses the pdf by using the file name).

 If you find a solution, please let me know.

 Cheers,

 Rainer
 If It is not possible, how can I create a gzip with the pdf?

 Thanks
 Daniele A.



 



 
 ORS Srl

 Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
 Tel. +39 0173 620211
 Fax. +39 0173 620299 / +39 0173 433111
 Web Site www.ors.it

 
 Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi allegati 
 ? vietato e potrebbe costituire reato.
 Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se 
 provvedesse alla distruzione dello stesso
 e degli eventuali allegati.
 Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non 
 siano relative alle attivit? e/o
 alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla 
 societ? stessa, n? la impegnano in alcun modo.

[[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.




--
Ista Zahn
Graduate student
University of Rochester
http://yourpsyche.org

ORS Srl

Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
Tel. +39 0173 620211
Fax. +39 0173 620299 / +39 0173 433111
Web Site www.ors.it


Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi allegati è 
vietato e potrebbe costituire reato.
Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se 
provvedesse alla distruzione dello stesso
e degli eventuali allegati.
Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non 
siano relative alle attività e/o
alla missione aziendale di O.R.S. Srl si intendono non  attribuibili alla 
società stessa, né la impegnano in alcun modo.

__
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] Compress (gzip) a pdf device - [ ] Message is from an unknown sender

2009-10-01 Thread Duncan Temple Lang

The latest version of the Rcompression package (www.omegahat.org/Rcompression)
provides a gzip() function that does this. The example in the help page shows
how.

There is a source version of the package in the Omegahat repository (and on the 
package's
Web site), but no binaries at this point.

 D.

Daniele Amberti wrote:
 system() invokes the OS command specified by command, in the example you gave 
 it means that gzip is installed and (assuming Windows OS) it is in your 
 search path.
 
 I'd like to have a solution that do not use external programs.
 
 Thanks
 Daniele
 
 -Original Message-
 From: Ista Zahn [mailto:istaz...@gmail.com]
 Sent: 01 October 2009 17:11
 To: Daniele Amberti
 Cc: r-help@r-project.org; Rainer M Krug
 Subject: Re: [R] Compress (gzip) a pdf device - [ ] Message is from an 
 unknown sender
 
 I guess I don't understand what your're trying to do. gzip-ing a file
 from within R is easy enough:
 
 pdf(file=CompressMe.pdf)
 plot(rnorm(100))
 dev.off()
 system(gzip CompressMe.pdf)
 
 I think you want something more complicated, but I'm not sure what.
 
 -Ista
 
 On Thu, Oct 1, 2009 at 6:41 AM, Daniele Amberti daniele.ambe...@ors.it 
 wrote:
 By now It seems nobody have idea.

 zz - gzfile(C:/gzpdftest.gz, wb)
 pdf(file = zz)
 plot(USArrests)
 dev.off()
 close(zz)

 produce a file named 3 without any extension in my working directory.

 Also I don't have any news on how to gzip the pdf afterward (without using 
 an external executable).

 Daniele


 From: Rainer M Krug [mailto:r.m.k...@gmail.com]
 Sent: 30 September 2009 10:26
 To: Daniele Amberti
 Cc: r-help@r-project.org
 Subject: Re: [R] Compress (gzip) a pdf device - [ ] Message is from an 
 unknown sender


 2009/9/30 Daniele Amberti 
 daniele.ambe...@ors.itmailto:daniele.ambe...@ors.it
 I have not found an easy way to compress a file on filesystem.
 Especially I'd like to compress a pdf from pdf() function/device. Is it 
 possible to compress It on the flight?
 I'd like to do something like:
 pdf(gzipconnection())
 dev.off()

 I guess this boils down to a question I asked some time ago concerning 
 getting the filename of a pdf() device, as I wanted to create a compressed 
 pdf from the uncompressed pdf created by R (not zipping the pdf).
 It does not seem to be possible, at least I did not get any response which I 
 could use to implement my idea (create my dev.off(), which calls dev.off() 
 and afterwards compresses the pdf by using the file name).

 If you find a solution, please let me know.

 Cheers,

 Rainer
 If It is not possible, how can I create a gzip with the pdf?

 Thanks
 Daniele A.



 



 
 ORS Srl

 Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
 Tel. +39 0173 620211
 Fax. +39 0173 620299 / +39 0173 433111
 Web Site www.ors.it

 
 Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi 
 allegati ? vietato e potrebbe costituire reato.
 Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se 
 provvedesse alla distruzione dello stesso
 e degli eventuali allegati.
 Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non 
 siano relative alle attivit? e/o
 alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla 
 societ? stessa, n? la impegnano in alcun modo.

[[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.

 
 
 
 --
 Ista Zahn
 Graduate student
 University of Rochester
 http://yourpsyche.org
 
 ORS Srl
 
 Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
 Tel. +39 0173 620211
 Fax. +39 0173 620299 / +39 0173 433111
 Web Site www.ors.it
 
 
 Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi allegati 
 è vietato e potrebbe costituire reato.
 Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se 
 provvedesse alla distruzione dello stesso
 e degli eventuali allegati.
 Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non 
 siano relative alle attività e/o
 alla missione aziendale di O.R.S. Srl si intendono non  attribuibili alla 
 società stessa, né la impegnano in alcun modo.
 
 __
 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

Re: [R] Compress (gzip) a pdf device

2009-10-01 Thread Martin Renner
try pdftk. Not quite on the fly but should do the trick. (I saw this  
on this list a little while ago)



pdfComp - function (pdfname){
  if (0){
x - tempfile()
system (paste (mv, pdfname, x))
system (paste (pdftk, x, output, pdfname, compress))
unlink (x)
  }
}

pdf (test.pdf)
plot (1:10)
dev.off()
pdfComp (test.pdf)

On 30 Sep 2009, at 00:25 , Rainer M Krug wrote:


2009/9/30 Daniele Amberti daniele.ambe...@ors.it


I have not found an easy way to compress a file on filesystem.
Especially I'd like to compress a pdf from pdf() function/device.  
Is it

possible to compress It on the flight?
I'd like to do something like:
pdf(gzipconnection())
dev.off()



I guess this boils down to a question I asked some time ago concerning
getting the filename of a pdf() device, as I wanted to create a  
compressed

pdf from the uncompressed pdf created by R (not zipping the pdf).
It does not seem to be possible, at least I did not get any response  
which I
could use to implement my idea (create my dev.off(), which calls  
dev.off()

and afterwards compresses the pdf by using the file name).

If you find a solution, please let me know.

Cheers,

Rainer

If It is not possible, how can I create a gzip with the pdf?


Thanks
Daniele A.




ORS Srl

Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
Tel. +39 0173 620211
Fax. +39 0173 620299 / +39 0173 433111
Web Site www.ors.it



Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi
allegati ? vietato e potrebbe costituire reato.
Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo  
grati se

provvedesse alla distruzione dello stesso
e degli eventuali allegati.
Opinioni, conclusioni o altre informazioni riportate nella e-mail,  
che non

siano relative alle attivit? e/o
alla missione aziendale di O.R.S. Srl si intendono non attribuibili  
alla

societ? stessa, n? la impegnano in alcun modo.

  [[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.





--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation  
Biology,

UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[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.


__
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] Compress (gzip) a pdf device

2009-09-30 Thread Daniele Amberti
I have not found an easy way to compress a file on filesystem.
Especially I'd like to compress a pdf from pdf() function/device. Is it 
possible to compress It on the flight?
I'd like to do something like:
pdf(gzipconnection())
dev.off()

If It is not possible, how can I create a gzip with the pdf?

Thanks
Daniele A.




ORS Srl

Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
Tel. +39 0173 620211
Fax. +39 0173 620299 / +39 0173 433111
Web Site www.ors.it


Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi allegati ? 
vietato e potrebbe costituire reato.
Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se 
provvedesse alla distruzione dello stesso
e degli eventuali allegati.
Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non 
siano relative alle attivit? e/o
alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla 
societ? stessa, n? la impegnano in alcun modo.

[[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] Compress (gzip) a pdf device

2009-09-30 Thread Rainer M Krug
2009/9/30 Daniele Amberti daniele.ambe...@ors.it

 I have not found an easy way to compress a file on filesystem.
 Especially I'd like to compress a pdf from pdf() function/device. Is it
 possible to compress It on the flight?
 I'd like to do something like:
 pdf(gzipconnection())
 dev.off()


I guess this boils down to a question I asked some time ago concerning
getting the filename of a pdf() device, as I wanted to create a compressed
pdf from the uncompressed pdf created by R (not zipping the pdf).
It does not seem to be possible, at least I did not get any response which I
could use to implement my idea (create my dev.off(), which calls dev.off()
and afterwards compresses the pdf by using the file name).

If you find a solution, please let me know.

Cheers,

Rainer

If It is not possible, how can I create a gzip with the pdf?

 Thanks
 Daniele A.



 
 ORS Srl

 Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
 Tel. +39 0173 620211
 Fax. +39 0173 620299 / +39 0173 433111
 Web Site www.ors.it


 
 Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi
 allegati ? vietato e potrebbe costituire reato.
 Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se
 provvedesse alla distruzione dello stesso
 e degli eventuali allegati.
 Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non
 siano relative alle attivit? e/o
 alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla
 societ? stessa, n? la impegnano in alcun modo.

[[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.




-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[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.