Learn R Programming

micEcon (version 0.5-6)

insertRow: Insert Row into a Matrix

Description

Insert a new row into a matrix.

Usage

insertRow( m, r, v = NA )

Arguments

m
matrix.
r
row number where the new row should be inserted.
v
optional values for the new row.

Value

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

See Also

insertCol.

Examples

Run this code
m <- matrix( 1:4, 2 )
   insertRow( m, 2, 5:6 )

Run the code above in your browser using DataLab