I have a matrix with 5 columns and 4 rows. I also have a vector with 3 columns. I want to subtract the values in the vector from columns 3,4 and 5 respectively at each row o
Another way, with apply:
b[,3:5] <- t(apply(b[,3:5], 1, function(x) x-c))