Description Usage Arguments Value Examples
View source: R/data.table_misc.R
Title
1 |
dt |
|
pct |
Percentage of data sampled |
grouping |
Grouping (a |
sort |
c('no', 'id', 'gr') |
data.table
with sampled data
1 2 3 4 5 6 7 8 9 | set.seed(2016)
size <- 10
dt <- data.table(
id = 1:size, A = sample(letters[1:3], size, replace = TRUE), B = 'N',
C = sample(1:100, size, replace = TRUE) + sample(30:70, size, replace = TRUE))
set.seed(2016)
sample_rows(dt, 0.5, grouping = 'A')
sample_rows(dt, 0.5, grouping = 'A', sort = TRUE)
sample_rows(dt, 0.5, grouping = c('A','B'), sort = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.