insertRow: Insert Row into a Matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/utils.R

Description

Insert a new row into a matrix.

Usage

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

Arguments

m

matrix.

r

row number where the new row should be inserted.

v

optional values for the new row.

rName

optional character string: the name of the new row.

Value

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

Author(s)

Arne Henningsen

See Also

insertCol.

Examples

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

Example output

     [,1] [,2]
[1,]    1    3
[2,]    5    6
[3,]    2    4

miscTools documentation built on Dec. 9, 2019, 3 a.m.