get_features: Retrieves features from Peak.list in a database

Description Usage Arguments Value Examples

View source: R/database-functions.R

Description

Returns mz/rt features from Peak.list stored in SQLite database

Usage

1
get_features(mytbl, peak.db, asdf)

Arguments

mytbl

character name of table in database to return

peak.db

Formal class SQLiteConnection

asdf

logical indicating whether to return a data frame instead of a tibble. Default is FALSE

Value

tbl alternatively a data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(LUMA)
if(require(RSQLite, quietly = TRUE)) {
file <- system.file("extdata","Sample_Data.csv", package =  "LUMA") # is case sensitive on Linux
sample_data <- read.table(file, header = TRUE, sep = ",")
mzdatafiles <- sample_data$CT.ID
file.base <- gen_filebase(mzdatafiles = mzdatafiles, BLANK = FALSE, IonMode =
"Positive", ion.id = c("Pos","Neg")) #Returns "Peaklist_Pos"
peak_db <- connect_peakdb(file.base = file.base, mem = TRUE)
dbIsValid(peak_db) #Database is valid
dbListTables(peak_db) #But no tables yet
mydf <- Peaklist_Pos$From_CAMERA
write_tbl(mydf = mydf, myname = "From_CAMERA", peak.db = peak_db)
test_tbl <- LUMA:::get_features(mytbl = "From_CAMERA", peak.db = peak_db)
test_tbl #Returns a tibble

test_df <- LUMA:::get_features(mytbl = "From_CAMERA", peak.db = peak_db, asdf = TRUE)
test_df #Returns a data frame

dbDisconnect(peak_db)
}

USEPA/LUMA documentation built on Aug. 29, 2020, 1:40 p.m.