flip.horz: Flip matrix horizontally

Description Usage Arguments Details Value Examples

View source: R/primitive.matrix.functions.R

Description

Flip given matrix on a vertical axis, returning it mirrored from left to right.

Usage

1

Arguments

x

a 2d-matrix

Details

t(apply(x,1,rev))

Value

the given matrix flipped from left to right

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
a<-matrix(1:9,3,3)
a
#     [,1] [,2] [,3]
#[1,]    1    4    7
#[2,]    2    5    8
#[3,]    3    6    9
flip.horz(a)
#     [,1] [,2] [,3]
#[1,]    7    4    1
#[2,]    8    5    2
#[3,]    9    6    3

nobodyinperson/matrixutils documentation built on May 23, 2019, 9:31 p.m.