[R] problem formatting data frames

Michael A. Miller mmiller3 at iupui.edu
Thu Jul 18 16:32:16 CEST 2002


>>>>> "Andrew" == Andrew C Ward <andreww at cheque.uq.edu.au> writes:

    > I would usually use something like 
    >    gawk ' BEGIN {FS="\t"} {if (NF==8) print $0 }' file.dat 

I tend to do the same sort of thing.  I'll usually just comment
out the lines I want to omit.  For example, if I know that the
lines I want to omit include the string 'error', I'd use

  gawk '{ if (/error/) { print "#", $0 } else { print $0 } }' file.dat > file.dat.commented

If I want to remove any line with an NA in it, I'd use

  gawk '{ if (/NA/) { print "#", $0 } else { print $0 } }' file.dat > file.dat.commented

Then, from R, I read'em with read.table.  

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