Learn R Programming

tropAlgebra (version 0.1.0)

copyMatrix: Copy Matrices

Description

This function copies the 1st matrix in second one if both the matirces are of equal number of rows and columns.

Usage

copyMatrix(x,y)

Arguments

x

A matrix to be copy

y

A matrix in which a matrix is to copy

Value

returns y copied from x

Details

e.g. x is a matrix. x<-matrix(c(1,2,3,4), nrow=2, ncol=2) and y is an empty matrix y<-matrix(data=NA, nrow=2, ncol=2) we want copy matirx 'x' into 'y'. This fuction do this. copyMatrix(x,y) now values of 'y' matirx will be same as of 'x' matrix.

Examples

Run this code
# NOT RUN {
    x<-matrix(c(1,2,3,4),nrow=2, ncol=2)
    y<-matrix(c(NA,NA,NA,NA),nrow=2, ncol=2)
    copyMatrix(x,y)
# }

Run the code above in your browser using DataLab