slice_sample.SummarizedExperiment | R Documentation |
Uses a slice operation to subset
## S3 method for class 'SummarizedExperiment'
slice_sample(.data, axis, ..., n, prop)
.data |
SummarizedExperiment to subset |
axis |
The axis to perform the operation on. Either row or col. |
... |
Arguments passed to dplyr::slice_sample |
n |
See prop |
prop |
Provide either n, the number of rows, or prop, the proportion of rows to select. If neither are supplied, n = 1 will be used. If n is greater than the number of rows in the group (or prop > 1), the result will be silently truncated to the group size. prop will be rounded towards zero to generate an integer number of rows. A negative value of n or prop will be subtracted from the group size. For example, n = -2 with a group of 5 rows will select 5 - 2 = 3 rows; prop = -0.25 with 8 rows will select 8 * (1 - 0.25) = 6 rows. |
A SummarizedExperiment after the sample operation
# subset 5 random columns
data(seq_se)
seq_se %>% slice_sample(col, n=5)
# randomly subset 20% of rows
seq_se %>% slice_sample(row, prop=.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.