Random Samples and Permutations for Data Frames
Source:R/sample_data_frame.R
sample.rows-deprecated.Rd
This function takes a sample of the specified size
from the rows of x
using either with or without replacement.
Details
This function internally calls sample.int()
.
Examples
set.seed(42)
sample.rows(
data.frame(a = c(1, 2, 3), b = c(4, 5, 6), row.names = c("a", "b", "c")),
10,
replace = TRUE
)
#> `sample.rows()` is deprecated, use `dplyr::sample_n()` instead.
#> a b
#> a 1 4
#> a.1 1 4
#> a.2 1 4
#> a.3 1 4
#> b 2 5
#> b.1 2 5
#> b.2 2 5
#> a.4 1 4
#> c 3 6
#> c.1 3 6