Nothing
#' Apply row left-right flips and column up-down flips to a matrix
#'
#' @param M Initial matrix
#' @param L1 Vector of row indices (1‑based) to be left-right flipped
#' @param L2 Vector of column indices (1‑based) to be up-down flipped
#'
#' @return Transformed matrix
#' @export
#'
transform_M <- function(M, L1, L2) {
M1 <- M
# Row left-right flip
for (r in L1) {
M1[r, ] <- rev(M1[r, ])
}
# Column up-down flip
for (c in L2) {
M1[, c] <- rev(M1[, c])
}
M1
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.