Learn R Programming

matrixcalc (version 1.0-6)

shift.right: Shift matrix n columns to the right

Description

This function returns a matrix that has been shifted to the right n columns filling the previous columns with the given fill value.

Usage

shift.right(A, cols = 1, fill = 0)

Value

A matrix.

Arguments

A

a matrix

cols

integer number of columns to be shifted to the right

fill

the fill which as default value zero

Author

Frederick Novomestky fnovomes@poly.edu

Examples

Run this code
A <- matrix( seq( 1, 16, 1 ), nrow=4, byrow=TRUE )
shift.right( A, 1 )
shift.right( A, 2 )

Run the code above in your browser using DataLab