Description Usage Arguments Value Examples
View source: R/database-functions.R
Extracts Peak.list from an SQLite database as a tibble. Alternatively, load the Peak.list into memory as a data frame
1 | read_tbl(mytable, peak.db, asdf)
|
mytable |
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 |
tbl alternatively a data frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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 <- read_tbl(mytable = "From_CAMERA", peak.db = peak_db)
identical(test,mydf) ## Objects are identical of class "tbl"
test2 <- read_tbl(mytable = "From_CAMERA", peak.db = peak_db, asdf = TRUE)
!identical(test2,mydf) ## test2 is a data.frame
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.