Skip to content
Prev 201654 / 398506 Next

How to sum only a few elements in a line

Tena koe Marcio

Try something like (untested)

apply(yourMatrix, 1, function(x) sum(x[x!=9])) 

HTH ...

Peter Alspach