[R] detecting blanks in read.table()

Mark Myatt mark at myatt.demon.co.uk
Wed Aug 1 12:36:05 CEST 2001


Laura Forsberg <toad at alvie-mail.lanl.gov> writes:
>Hi everyone,
>
>I am trying to read in a tab delimited data file to R that has outliers
>marked by blank spaces.  I would like to be able to tag those as "NA"
>when the data is read in.  I cannot figure out how to do this using the
>read.table() options.  Everything I have tried either puts all the NA on
>the end of the row when there are missing values instead of on their
>appropiate columns or won't read the data in at all.
>

I think you need to fiddle with the sep and na.strings parameters. Try:

        read.table("file", na.strings = " ", sep = "\t")

for a start.

Mark    


--
Mark Myatt


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