dplyr like sample_n for a matrix

sample_n_matrix(mat, n, replace = FALSE, weight = NULL)

Arguments

mat

A matrix

n

Number of rows to sample

replace

See arguments for 'base::sample'

weight

See arguments for 'base::sample'

Value

A matrix library("magrittr") mat <- matrix(1:1e4, ncol = 10) mat