mercredi 8 juillet 2015

Sum up values only if there is no NA in R

I want to sum up values from 3 columns only, if no column at position [i,j] has a NA value.

I tried this for the if clause, but it won't work:

  if(stat1[i,]!=NA&&stat2[i,]!=NA&&stat3[i,]!=NA)

is syntax like this possible in R?

Best regards Jochen

Aucun commentaire:

Enregistrer un commentaire