[R] missing values in an array

Berend Hasselman bhh at xs4all.nl
Fri Mar 15 17:31:31 CET 2013


On 15-03-2013, at 17:08, Ray Cheung <ray1728 at gmail.com> wrote:

> Dear All,
> 
> I've an array with some missing values (NA) in between. I want to remove
> that particular matrix if a missing value is detected. How can I do so?
> Thank you very much.


It is not clear what the dimension of your array is.

If your array/matrix is two dimensional, then then

any(is.na(A))  # A is the name of the array/matrix

will return TRUE is at least one element of A is NA. And then you can delete A.

If you array has three dimensions then you'll have to look at arun's solution.

Berend


More information about the R-help mailing list