Unix tools (was: [R] read data into R with some constraints)
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 http://www.delorie.com/ 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. Clive Jenkins --->8 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._