Learn R Programming

matrixcalc (version 1.0-6)

set.submatrix: Store matrix inside another matrix

Description

This function returns a matrix which is a copy of matrix x into which the contents of matrix y have been inserted at the given row and column.

Usage

set.submatrix(x, y, row, col)

Value

A matrix.

Arguments

x

a matrix

y

a matrix

row

an integer row number

col

an integer column number

Author

Frederick Novomestky fnovomes@poly.edu

Examples

Run this code
x <- matrix( seq( 1, 16, 1 ), nrow=4, byrow=TRUE )
y <- matrix( seq( 1, 4, 1 ), nrow=2, byrow=TRUE )
z <- set.submatrix( x, y, 3, 3 )

Run the code above in your browser using DataLab