Learn R Programming

MVNBayesian (version 0.0.8-11)

MatrixAlternative: Interchanging specified rows and columns

Description

Interchange all elements between two specified rows and columns in a matrix.

Usage

# A matrix-like data
MatrixAlternative(data, sub, rep)

Arguments

data

A matrix to be processed.

sub

A positive integer. The first selected dimension.

rep

A positive integer. The second selected dimension. Default value is 1.

Value

return a matrix with interchanged rows and columns in two specified dimensions.

Examples

Run this code
# NOT RUN {
library(plyr)

M <- matrix(1:9,3,3,1)
M
MatrixAlternative(M, 2)
# }

Run the code above in your browser using DataLab