Вопрос

For example,

> a<-c(1:5)
> b<-c(10-15)
> a-b
[1]  6  7  8  9 10

Here, how to skip NAs, if present in one (a or b) or both (a and b).

Preferably, how to do this without any complex conditional statement?

Это было полезно?

Решение

> a<-c(1:5)
> b<-c(10-15)

Just use na.omit(a-b)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top