Re: [R] detect filetype (as in unix 'file')

2011-04-05 Thread Jeroen Ooms
 No, but what is wrong with using system()?

The application is running in a very sandboxed environment and might
not have permission to execute 'file'.

 'file' is large and complex because it tries to be comprehensive (but it
 still does not know about some common systems, e.g. 64-bit Windows
 binaries).  There simply is no point in replicating that in R: which is why
 we chose rather to port 'file' to Windows and provide in in Rools.

Alright that makes sense, thanks.

__
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] detect filetype (as in unix 'file')

2011-04-04 Thread Prof Brian Ripley

On Sun, 3 Apr 2011, Jeroen Ooms wrote:


Is there a way in R (in Linux) to detect the type of a file without invoking
a shell? E.g to do this:


system(file density.plot)

density.plot: PDF document, version 1.4

but without using system()? I tried file() and file.info(), but both do
display the information I am looking for.


No, but what is wrong with using system()?

'file' is large and complex because it tries to be comprehensive (but 
it still does not know about some common systems, e.g. 64-bit Windows 
binaries).  There simply is no point in replicating that in R: which 
is why we chose rather to port 'file' to Windows and provide in in 
Rools.


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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