sample.by.id | R Documentation |
Populates 1 sample from prespecified distribution for each group (id or subject, or trial, or other)
sample.by.id(id, samples, replace = TRUE)
id |
vector with group information |
samples |
distribution to sample from |
replace |
if TRUE (default) sampling will be done with replacement |
samples of the prespecified distribution, one for each level of group
rnorm.by.id
my.ids = rep(1:5,each = 3)
my.ids
set.seed(123456)
sample.by.id(my.ids, samples = rgamma(1000,1))
my.ids = rep(1:5,times = 3)
my.ids
sample.by.id(my.ids, samples = rgamma(1000,1))
#one unique value per id
sample.by.id(unique(my.ids), samples = rgamma(1000,1))
tapply(sample.by.id(my.ids, samples = rgamma(1000,1)),my.ids, unique)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.