R/repmat.R

#' Replicate and tile array
#'
#' Just the same usage as repmat function in Matlab. This kind of functions
#' can be easily found on the web.
#'
#' @param A Matrix or vector to repeat.
#' @param M Number of row repititions.
#' @param N Number of column repititions.
#' @return a matrix of M-by-N tiling of A.
#' @export
#' @examples
#' repmat(c(1, 2), 6, 8)

repmat <- function(A, M, N) 
{
	# Replicate matrix and vector
	# Just the same usage as repmat in Matlab
    return(kronecker(matrix(1, M, N), A))
}

Try the StatMethRank package in your browser

Any scripts or data that you put into this service are public.

StatMethRank documentation built on Jan. 15, 2017, 8:59 p.m.