You can add the argument na.print=" " to print() to make
the missing values print as " " instead of as NA. Some,
but not all print methods support this. E.g.,
> print(c(1,2,NA,4,5,NA), na.print="-")
[1] 1 2 - 4 5 -
> print(matrix(c(1,2,NA,4,5,NA),2), na.print="-")
[,1] [,2] [,3]
[1,]
> 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
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
, February 17, 2016 2:01 PM
> To: Jan Kacaba
> Cc: r-help@r-project.org
> Subject: Re: [R] missing values in csv file
>
> On Wed, Feb 17, 2016 at 12:04 PM, Jan Kacaba
> wrote:
>
> > In my original data a csv file I have missing values. If I use
> > read.table the mi
On Wed, Feb 17, 2016 at 12:04 PM, 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.
>
That is the normal way of dealing with missing values, in R.
Is it possible to get object where missing values aren't repl
5 matches
Mail list logo