sample_n | R Documentation |
Sample n shapes from a Momocs object. See examples and ?dplyr::sample_n
.
sample_n(tbl, size, replace, fac, ...)
tbl |
a Momocs object (Coo, Coe) |
size |
numeric how many shapes should we sample |
replace |
logical whether sample should be done with ot without replacement |
fac |
a column name if a |
... |
additional arguments to dplyr::sample_n and to maintain generic compatibility |
a Momocs object of same class
Other handling functions:
arrange()
,
at_least()
,
chop()
,
combine()
,
dissolve()
,
fac_dispatcher()
,
filter()
,
mutate()
,
rename()
,
rescale()
,
rm_harm()
,
rm_missing()
,
rm_uncomplete()
,
rw_fac()
,
sample_frac()
,
select()
,
slice()
,
subsetize()
# samples 5 bottles no matter their type
sample_n(bot, 5)
# 5 bottles of beer and of whisky
table(sample_n(bot, 5, fac="type")$type)
# many repetitions
table(names(sample_n(bot, 400, replace=TRUE)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.