write_tbl: Writes Peak.list to database

Description Usage Arguments Value Examples

View source: R/database-functions.R

Description

Writes Peak.list to an RSQLite database. Peak.list can be a tibble or data frame.

Usage

1
write_tbl(mydf, peak.db, myname)

Arguments

mydf

tbl or dataframe to write

peak.db

Formal class SQLiteConnection

myname

character what should the table be called

Value

a tbl object in the remote source

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)
dbListTables(peak_db) #Now has tables
dbDisconnect(peak_db)
}

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