Description Usage Arguments Details Value Examples
This function takes a sample of the specified size
from the rows of x
using either with or without replacement.
1 | sample.rows(x, size, replace = FALSE, prob = NULL)
|
x |
A data frame. |
size |
A non-negative integer giving the number of items to choose. |
replace |
Should sampling be with replacement? |
prob |
A vector of probability weights for obtaining the rows of the data frame being sampled. |
This function internally calls sample.int
.
A data frame of the same shape as x
.
1 2 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.