Re: [R] Setting NA to blank

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Mon, 09 May 2011 12:25:54 -0700 (PDT)

(mat <- matrix(c(1,2,3,NA),2))
mat[is.na(mat)] <- " "
mat

But if you have a numerical matrix it coverts the matrix to character.

> From: Dat Mai <dat.d.mai_at_gmail.com>
> Subject: [R] Setting NA to blank
> To: r-help_at_r-project.org
> Received: Monday, May 9, 2011, 2:46 PM
> Hey All,
>
> I have a matrix m, and I wish to set all the NA values to
> blank. How would I
> do so?
>
> --
> Best,
> Dat Mai
> PhD Rotation Student
> Albert Einstein College of Medicine



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. Received on Mon 09 May 2011 - 19:28:49 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 09 May 2011 - 20:10:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive