Learn R Programming

eemR (version 0.1.2)

eem_extract: Extract EEM samples

Description

Extract EEM samples

Usage

eem_extract(eem, sample, remove = FALSE, ignore_case = FALSE)

Arguments

eem
Either an object of class eem or eemlist.
sample
Either numeric of character vector. See details for more information.
remove
logical. Should EEMs removed (TRUE) or extracted (FALSE).
ignore_case
Logical, should sample name case should be ignored (TRUE) or not (FALSE). Default is FALSE.

Value

  • Either an object of class eem or eemlist.

Details

sample argument can be either numeric or character vector. If it is numeric, samples at specified index will be removed.

If sample is character, regular expression will be used and all sample names that have a partial or complete match with the expression will be removed. See examples for more details.

Examples

Run this code
folder <- system.file("extdata/cary/eem", package = "eemR")
eems <- eem_read(folder)

eem_extract(eems, c(1, 3)) ## Removes samples 1 and 3
eem_extract(eems, c(1, 3), remove = TRUE) ## extract samples 1 and 3

## Remove all samples containing "3" in their names.
eem_extract(eems, "3")

## Remove all samples containing either character "s" or character "2" in their names.
eem_extract(eems, c("s", "2"))

## Remove all samples containing "blank" or "nano"
eem_extract(eems, c("blank", "nano"))

## Remove all samples starting with "no"
eem_extract(eems, "^no")

Run the code above in your browser using DataLab