Description Usage Arguments Details Value
Translates a matrix in a given direction (or directions)
1 | slide_matrix(mat, directions, fill = NA, simplify = FALSE)
|
mat |
- the matrix to slide |
directions |
- a dataframe of the directions in which to slide the matrix, each row being the row-column coordinates of a direction vector (see details) |
fill |
- the value with which to fill empty space left from sliding the given matrix |
simplify |
- whether to merge results into a matrix or return a list of slidden matrices (see details) |
If simplify = TRUE, than this returns a matrix where each column is a matrix unrolled into a vector. If simplify = FALSE, this returns a list of matrices resulted from sliding the given matrix in given directions.
Directions should be a dataframe with columns named 'row' and 'col' and each row in the dataframe is a row-col vector which gives the direction for translation. If 'row' and 'col' aren't the names of columns, the first column in the dataframe will be treated as 'row' and the second as 'col'.
If only one direction is given, it needn't be a dataframe, but can be just a vector with row-col coordinates.
Matrix (or list of matrices) which represent mat translated in given direction(s). See details.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.