What are some convenient methods to sum selected rows or columns in a matrix? This question Summing along rows or columns of a matrix only addresses how to sun entire rows or columns ie, by level.
For example, suppose one wants to add columns 2 and 4 of:
M = Column@Table[RandomInteger[10], {3}, {4}];
Neither MapAt, nor ReplacePart appear useful in this regard.
Of course #[[2]] + #[[4]] & /@ M
works for summing columns and Transpose
can be used for rows, but that seems like a hack to specify using such syntax. Any better solutions?