use  na.strings = ''

> x <- read.table(text = "635     LA 201207  557329
+ 636     LA 201208  683771
+ 637     LA 201209  613851
+ 638     LA 201210  764217
+ 639     LA 201211  212897
+ 782   NA 200701  875634
+ 783   NA 200702  614856
+ 784   NA 200703  521520
+ 785   NA 200704 1406400", as.is = TRUE, na.strings = '')
> x
   V1 V2     V3      V4
1 635 LA 201207  557329
2 636 LA 201208  683771
3 637 LA 201209  613851
4 638 LA 201210  764217
5 639 LA 201211  212897
6 782 NA 200701  875634
7 783 NA 200702  614856
8 784 NA 200703  521520
9 785 NA 200704 1406400
> dput(x)
structure(list(V1 = c(635L, 636L, 637L, 638L, 639L, 782L, 783L,
784L, 785L), V2 = c("LA", "LA", "LA", "LA", "LA", "NA", "NA",
"NA", "NA"), V3 = c(201207L, 201208L, 201209L, 201210L, 201211L,
200701L, 200702L, 200703L, 200704L), V4 = c(557329L, 683771L,
613851L, 764217L, 212897L, 875634L, 614856L, 521520L, 1406400L
)), .Names = c("V1", "V2", "V3", "V4"), class = "data.frame", row.names = c(NA,
-9L))


On Sun, Nov 18, 2012 at 4:18 PM, eric <ericst...@aol.com> wrote:
> I am reading some data into R from an Excel spreadsheet using read.csv. Some
> of the original data that comes into column 1 from the spreadsheet is text
> that says NA. The NA stands for north america. As it comes in, R converts
> the NA over to  <NA>.
>
> What is the cleanest way to change the <NA>  values to something else. In
> other words, get rid of the brackets ? Maybe convert <NA> to NAM.
>
> 635     LA 201207  557329
> 636     LA 201208  683771
> 637     LA 201209  613851
> 638     LA 201210  764217
> 639     LA 201211  212897
> 782   <NA> 200701  875634
> 783   <NA> 200702  614856
> 784   <NA> 200703  521520
> 785   <NA> 200704 1406400
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Replace-NA-with-something-else-tp4649974.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

______________________________________________
R-help@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.

Reply via email to