R/global.R
replaceDown.Rd
F matrices utility function.
replaceDown(a, b, k)
The matrix to be replaced
The matrix with the replacement values
The extend of the replacement: 0 (lower part and diagonal only), 1 (lower part and first extra diagonal), in general an entry is replaced if -(row(a) - col(a)) <= k
A matrix (same size as a)
Bertrand Frederic, Myriam Maumy-Bertrand.
a=matrix(1:9,3,3) b=matrix(1,3,3) replaceDown(a,b,0) #> [,1] [,2] [,3] #> [1,] 1 4 7 #> [2,] 1 1 8 #> [3,] 1 1 1 replaceDown(a,b,1) #> [,1] [,2] [,3] #> [1,] 1 1 7 #> [2,] 1 1 1 #> [3,] 1 1 1 replaceDown(a,b,2) #> [,1] [,2] [,3] #> [1,] 1 1 1 #> [2,] 1 1 1 #> [3,] 1 1 1