R/rep_row.R

Defines functions rep_row

Documented in rep_row

#' @title rep_row
#'
#' @description Helper function to repeat a matrix by row
#'
#' @param x vector to repeat
#' @param n number of repetions
#'
#' @return Matrix with vector x repeated n-times by rows.
#'
#' @examples
#'set.seed(1)
#'rep_row(rnorm(5), 5)
#' @export
#' @import dplyr ggplot2 plotly tidyr ggthemes
#'

rep_row = function(x,n){
  matrix(rep(x,each=n),nrow=n)
}

Try the cities package in your browser

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

cities documentation built on Aug. 8, 2023, 9:06 a.m.