Learn R Programming

matrixcalc (version 1.0-6)

shift.up: Shift matrix m rows up

Description

This function returns a matrix where the argument as been shifted up the given number of rows filling the bottom rows with the given fill value.

Usage

shift.up(A, rows = 1, fill = 0)

Value

A matrix.

Arguments

A

a matrix

rows

integer number of rows

fill

fill value which as the default value of zero

Author

Frederick Novomestky fnovomes@poly.edu

Examples

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

Run the code above in your browser using DataLab