select: Reduce samples to a specific list

Description Usage Arguments Value See Also Examples

Description

Reduce samples to a specific list

Usage

1
select(biom, samples = NULL, nTop = NULL, nRandom = NULL, seed = 0)

Arguments

biom

A BIOM object, as returned from read.biom.

samples

Sample names, indices, or a logical vector identifying the samples to keep. The latter two should be based on the order of sample names given by colnames(biom$counts).

nTop

Selects this number of samples, taking the sample with the most observations first, then the sample with the second-most observations, etc. If nTop is higher than the number of samples in the dataset, the entire dataset will be returned. See note.

nRandom

Randomly selects this number of samples. If higher than the number of samples in the dataset, the entire dataset will be returned. See note.

seed

Random seed, used when selecting nRandom samples.

Note: Generally, you will specify only one of the filters: samples, nTop, or nRandom. However, specifying multiple filters is allowed; they will be applied in the order listed above.

Value

A BIOM object.

See Also

subset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
    library(rbiom)
    
    infile <- system.file("extdata", "hmp50.bz2", package = "rbiom")
    biom <- read.biom(infile)
    
    ex1 <- select(biom, c('HMP14', 'HMP22', 'HMP03'))
    ex2 <- select(biom, c(32, 11, 28, 16, 46, 5))
    ex3 <- select(biom, 1:50 %% 6 == 0)
    ex4 <- select(biom, nRandom = 10)
    ex5 <- select(biom, nTop = 5)
    ex6 <- select(biom, samples = 10:40, nTop = 20, nRandom = 10)

rbiom documentation built on Nov. 5, 2021, 9:11 a.m.