Learn R Programming

miscTools (version 0.6-28)

insertCol: Insert Column into a Matrix

Description

Insert a new column into a matrix.

Usage

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

Value

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

Arguments

m

matrix.

c

column number where the new column should be inserted.

v

optional values of the new column.

cName

optional character string: the name of the new column.

Author

Arne Henningsen

See Also

insertRow.

Examples

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

Run the code above in your browser using DataLab