Learn R Programming

calcWOI (version 1.0.3)

shiftmat: Shifts the elements of a matrix

Description

This function shifts the elements of an array to the right and the top.

Usage

shiftmat(x, dx = 0, dy = 0)

Arguments

x

2D array.

dx

Integer number. Number of grid points to shift the array to the north. Should be smaller than dim(x). Default is 0.

dy

Integer number. Number of grid points to shift the array to the west. Should be smaller than dim(x). Default is 0.

Value

Returns an array with shifted elements.

Examples

Run this code
# NOT RUN {
# shift the matrix dx = 1 and dy = 2 grid points
x <- array(1:48, dim = c(6, 8))
xshift <- shiftmat(x = x, dx = 1, dy = 2) 
# }

Run the code above in your browser using DataLab