swap: Switching rows and columns

Description Usage Arguments Value Examples

Description

This function is used to exchange two columns and rows of a matrix.

Usage

1
swap(mat, i, j)

Arguments

mat

matrix - The matrix you want to modify

i

integer - The first column and row to be exchanged.

j

integer - The column and row to switch with the ith column and ith row.

Value

The matrix mat where the columns i and j are switched and the rows i and j are switched.

Examples

1
2
3
p<-10
W1=1*upper.tri(matrix(0,p,p))
swap(W1,9,5)

andreamrau/GBNcausal documentation built on May 12, 2019, 3:34 a.m.