slice_metadata | R Documentation |
Subset to a specific number of samples.
## S3 method for class 'rbiom'
slice(.data, ..., .by = NULL, .preserve = FALSE, clone = TRUE)
## S3 method for class 'rbiom'
slice_head(.data, n, prop, by = NULL, clone = TRUE, ...)
## S3 method for class 'rbiom'
slice_tail(.data, n, prop, by = NULL, clone = TRUE, ...)
## S3 method for class 'rbiom'
slice_min(
.data,
order_by,
n,
prop,
by = NULL,
with_ties = TRUE,
na_rm = FALSE,
clone = TRUE,
...
)
## S3 method for class 'rbiom'
slice_max(
.data,
order_by,
n,
prop,
by = NULL,
with_ties = TRUE,
na_rm = FALSE,
clone = TRUE,
...
)
## S3 method for class 'rbiom'
slice_sample(
.data,
n,
prop,
by = NULL,
weight_by = NULL,
replace = FALSE,
clone = TRUE,
...
)
.data |
An rbiom object, such as from |
... |
For |
.by , by |
< |
.preserve |
Relevant when the |
clone |
Create a copy of |
n , prop |
Provide either A negative value of |
order_by |
< |
with_ties |
Should ties be kept together? The default, |
na_rm |
Should missing values in |
weight_by |
< |
replace |
Should sampling be performed with ( |
An rbiom object.
Other transformations:
modify_metadata
,
rarefy()
,
rarefy_cols()
,
subset()
,
with()
library(rbiom)
# The last 3 samples in the metadata table.
biom <- slice_tail(hmp50, n = 3)
biom$metadata
# The 3 oldest subjects sampled.
biom <- slice_max(hmp50, Age, n = 3)
biom$metadata
# Pick 3 samples at random.
biom <- slice_sample(hmp50, n = 3)
biom$metadata
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.