[R] missings

jim holtman jholtman at gmail.com
Thu Mar 5 18:08:32 CET 2009


This seems to work fine without the na.strings.  Can you include the
data that you were reading:

> x <- read.table(textConnection("1,2,3,4
+ 5,,6,NA
+ ,7,NA,8
+ ,,NA,9"), sep=',')
> closeAllConnections()
> x
  V1 V2 V3 V4
1  1  2  3  4
2  5 NA  6 NA
3 NA  7 NA  8
4 NA NA NA  9


On Thu, Mar 5, 2009 at 10:37 AM, kayj <kjaja27 at yahoo.com> wrote:
>
>
>
> I have a file where the missings are coded as NA or blank. how can I tell R
> to read the data set and to consider the missings NA or a blank.
>
> I tried the following
>
> data<-read.table("data.txt", sep='\t', header=T, na.strings=c("NA",""))
>
> is it correct? I am new to R and I am not sure if R is condisering the
> blanks as missings in the above.
>
> Thanks for the help
>
> --
> View this message in context: http://www.nabble.com/missings-tp22354037p22354037.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list