Skip to content
Back to formatted view

Raw Message

Message-ID: <CA+nJqYPaJiohze6zXSX12wAhsDX3uuh1ZGqJQK1+CSpFrwvHYw@mail.gmail.com>
Date: 2012-05-03T17:57:24Z
From: James
Subject: How to replace NA with zero (0)
In-Reply-To: <1336059797.73905.YahooMailNeo@web65415.mail.ac4.yahoo.com>

On Thu, May 3, 2012 at 10:43 AM, Christopher Kelvin
<chris_kelvin2001 at yahoo.com> wrote:

> Is there a command i can issue to replace the NA with zero (0) even if it is after generating the data?

Chris,

I didn't try your example code, so this suggestion is far more
general, but you might try something along the lines of:

x[which(is.na(x))] <- 0

Best,

James