powered by
Inserts a row and keeps the attributes copyAllNewAttributes
copyAllNewAttributes
insertRowAndKeepAttr(m, r, v = NA, rName = "")
matrix Returns a matrix with one more row than the provided matrix m
matrix
m
row number where the new row should be inserted
optional values for the new row
optional character string: the name of the new row.
Max Gordon, Arne Henningsen
test <- matrix(1:4, ncol = 2) attr(test, "wow") <- 1000 test <- insertRowAndKeepAttr(test, 2) print(attr(test, "wow"))
Run the code above in your browser using DataLab