[R] missing values in csv file

S Ellison S.Ellison at LGCGroup.com
Wed Feb 17 14:37:27 CET 2016


> Is it possible to get object where missing values aren't replaced with NAs?
Not with read.table, if they are really missing. But you can replace them later - see below - and if they are marked you can change what read.table considers to be 'missing'.

> Is it possible to replace NAs with empty space?
NA _is_ an 'empty space', in the sense of a correctly recorded missing value.

If you mean some other kind of empty space - perhaps the string "" - that's not missing, just empty (!).

But with a vector containing NA's, like
(  x <- c(NA, NA, letters[1:5]) )

you can do things like 

x[is.na(x)] <- "Empty Space"
x

or
x[is.na(x)] <- ""

S Ellison


*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list