Layla
Layla

Reputation: 5446

NA vector in language R

How I can identify if a resulting vector from one computation is full of the NA values? Thanks

Upvotes: 1

Views: 157

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368201

Via all(is.na(x)):

R> x1 <- 1:3
R> all(is.na(x1))
[1] FALSE
R> x2 <- x1 * NA
R> all(is.na(x2))
[1] TRUE
R> 

Upvotes: 7

Related Questions