Unix tools (was: [R] read data into R with some constraints)
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Fri Jan 12 19:40:01 CET 2001
On Fri, 12 Jan 2001, Clive Jenkins wrote:
> Thu, 11 Jan 2001 14:51:16 -0500 (EST) Jonathan Baron wrote:
> > >I have a big data file (over 30,000 records) looks
> > >like this:
> > >
> > >100, 20, 46, 70
> > >103, 0, 22, 45
> > >117, -1, 34, 65
> > >120, 15, 0, 25
> > >113, 0, -1, 32
> > >142, -1, -1, 55
> > >.....
> > >
> > >I want to read only those records having positive
> > >values in all of the four
> > >columns. That is, I don't want to read record # 3, 5,
> > >and 6 into R.
> > Perhaps someone knows how to do this with R, but, if
> > I had to do it right now, I would pre-process with grep
> > before reading into R:
> > grep -v "-" myddata > myshorterdata
> > The "grep" tool is available on Unix and Linux. If you have
> > Windows, it would be useful to get the "unix tools for windows",
> > which, unfornuately, I have just been unable to find after 10
> > minutes of searching www.gnu.org.
> I recommend the DJGPP (DOS/DPMI) ports of the Gnu tools available at
> They are absolute magic for anybody who is frustrated by Windows and has
> not yet moved to Gnu/Linux. I find "gawk" (or "awk") especially useful.
Can I emphatically *not* recommend those, but the genuine Windows ones at
http://www.cygwin.com instead? Particularly if you have NT/2000 and NTFS
file systems. The DJGPP tools have frustrating limitations (e.g. on line
lengths) even for Win95 users. And DJ Delorie works for Cygwin anyway.
As I posted earlier, a subset of the Cygwin tools and some others
have been collected for building R, at
We keep these up to date, but not in the (common) cases where the latest
versions are broken. What is there will have built R in the last few days.
There quite a few other Unix-alike tool sets around, but none that
I have found anything like as good.
Brian D. Ripley, ripley at 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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help