[R] missing values in csv file

Michael Dewey lists at dewey.myzen.co.uk
Wed Feb 17 14:19:20 CET 2016

Assuming it is a character variable

test <- c("a", NA, "b")
 > test
[1] "a" NA  "b"
 > test[is.na(test)] <- " "
 > test
[1] "a" " " "b"

but if it is numeric this as, as others have said, almost certainly not 
what you really wanted to do

On 17/02/2016 10:04, Jan Kacaba wrote:
> In my original data a csv file I have missing values. If I use read.table
> the missing values are replaced by NAs.
> Is it possible to get object where missing values aren't replaced with NAs?
> Is it possible to replace NAs with empty space?
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.


More information about the R-help mailing list