Learn R Programming

eemR (version 1.0.1)

eem_extract: Extract EEM samples

Description

Extract EEM samples

Usage

eem_extract(eem, sample, keep = FALSE, ignore_case = FALSE,
  verbose = TRUE)

Arguments

eem

An object of class eemlist.

sample

Either numeric of character vector. See details for more information.

keep

logical. If TRUE, the specified sample will be returned. If FALSE, they will be removed.

ignore_case

Logical, should sample name case should be ignored (TRUE) or not (FALSE). Default is FALSE.

verbose

Logical determining if removed/extracted eems should be printed on screen.

Value

An object of class 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
# NOT RUN {
folder <- system.file("extdata/cary/scans_day_1", package = "eemR")
eems <- eem_read(folder, import_function = "cary")

eems

# Remove first and third samples
eem_extract(eems, c(1, 3))

# Remove everything except first and third samples
eem_extract(eems, c(1, 3), keep = TRUE)

# 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"))
# }

Run the code above in your browser using DataLab