R Under development (unstable) (2023-11-07 r85491 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## > ## f l i p d i m . R tests > ## > > flipdim <- pracma::flipdim > flipud <- pracma::flipud > fliplr <- pracma::fliplr > rot90 <- pracma::rot90 > > a <- matrix(c(1,2,3, 4,5,6, 7,8,9, 10,11,12), nrow=3, ncol=4) > b <- matrix(c(1,2, 3,4), nrow=2, ncol=2, byrow=TRUE) > > identical(flipdim(a, 1), flipud(a)) [1] TRUE > identical(fliplr(a), matrix(c(10,11,12, 7,8,9, 4,5,6, 1,2,3 ), 3, 4)) [1] TRUE > identical(rot90(b, k=1), matrix(c(2,1, 4,3), 2, 2)) [1] TRUE > identical(rot90(b, k=6), matrix(c(4,2, 3,1), 2, 2)) [1] TRUE > identical(rot90(b, k=-1), matrix(c(3,4, 1,2), 2, 2)) [1] TRUE > > proc.time() user system elapsed 0.10 0.06 0.15