Skip to content
Prev 307125 / 398506 Next

loop for column substraction of a matrix

Hello,

1. Let me refrase it a bit. For each column, sum all others and take the 
symmetric.


mat <- matrix(1:30, ncol = 3)
sapply(seq_len(ncol(mat)), function(i) -rowSums(mat[, -i]))


2. write.table (maybe using sep = "\t" ?) and send the file to printer.

Hope this helps,

Rui Barradas

Em 05-10-2012 21:05, eliza botto escreveu: