Insert Row into a Matrix

insertCol(m, c, v = NA, cName = "")

Arguments

m

(Required). a matrix.

c

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

v

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

cName

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

Value

a matrix with one more column 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)
insertCol(m, 2, 5:6)
}