Learn R Programming

matrixcalc (version 1.0-6)

shift.left: Shift a matrix n columns to the left

Description

This function returns a matrix that has been shifted n columns to the left filling the subsqeuent columns with the given fill value

Usage

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

Value

A matrix.

Arguments

A

a matrix

cols

integer number of columns to be shifted to the left

fill

the fill value which as as a default zero

Author

Frederick Novomestky fnovomes@poly.edu

Examples

Run this code
A <- matrix( seq( 1, 12, 1 ), nrow=3, byrow=TRUE )
shift.left( A, 1 )
shift.left( A, 2 )

Run the code above in your browser using DataLab