Insert Row into a Matrix

insertRow(m, r, v = NA, rName = "")

Arguments

m

(Required). a matrix.

r

(Required). numeric. row number where the new row should be inserted.

v

(optional). numeric. values for the new row.

rName

(optional). character. the name of the new row.

Value

a matrix with one more row than the provided matrix m.

References

https://github.com/cran/miscTools/

Author

Created by Hua Zou (5/19/2022 Shenzhen China)

Examples

if (FALSE) {
m <- matrix(1:4, 2)
insertRow(m, 2, 5:6)
}