[R] read data into R with some constraints

Jonathan Baron baron at cattell.psych.upenn.edu
Thu Jan 11 20:51:16 CET 2001


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

Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~jbaron
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list