[R] Reading Post-Script files
(Ted Harding)
ted.harding at nessie.mcc.ac.uk
Tue Feb 20 16:11:37 CET 2007
On 20-Feb-07 Ralf Finne wrote:
> Hi everybody!
> Is there any way to read a postscrit file into R?
>
> All the best to you
> Ralf Finne
> SYH University of Applied Sciences
> Vasa Finland
Well, yes ... since a PostScript file is ASCII text you could
use readline() ... but what you'd do with it after that I cannot
imagine! [So I'm joking here]
So, to come to the point: Why do you want to do that?
If, for example, the PS file displays tabular data which you
want to read into R as data, then perhaps one way would be to
use suitable utility software to convert the PS file to a PDF
file. Then you can display the PDF file using Acrobat Reader,
and use the mouse to copy the data into a file which you can
then edit up so that it can be read nicely into a dataframe
in R.
There are also utilities called ps2ascii (part of ghostscript;
often fails to do a clean job) and pstotext which you can get
from
http://www.cs.wisc.edu/~ghost/doc/pstotext.htm
(which claims to do a better job, though I've not tested it)
which can convert a PS file into an ASCII text file which
gives essentially the same text layout as seen when you
display/print the PS file.
You may then be able to edit this into a form which R can read
as you want.
But, for better targeted advice, it would be useful to know
why you want to "read a PDF file into R"!
Best wishes,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <ted.harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 20-Feb-07 Time: 15:11:34
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list