/
user_functions.R
31 lines (31 loc) · 1.03 KB
/
user_functions.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#' Create your own database
#'
#' Quickly create your own SQLite database dump from
#' dataframes without additional software.
#'
#' @param path string,
#' Path to where you want to save the database dump file
#'
#' @param metaData tibble.
#' A data.frame with the information about your datasets
#' See README on href{https://github.com/jmbuhr/ShinyLipids}{github} for the columns it needs.
#'
#' @param rawData
#' tibble. Metadata of the data sets
#' See README on href{https://github.com/jmbuhr/ShinyLipids}{github} for the columns they need.
#'
#' @param overwrite boolean.
#' Overwrite existing .db file? Default is FALSE.
#'
#' @return
#' NULL
#' @export
createDatabase <- function(path = "databaseDump.db",
metaData,
rawData,
overwrite = FALSE) {
con <- DBI::dbConnect(RSQLite::SQLite(), path)
DBI::dbWriteTable(con, "id_info", metaData, overwrite = overwrite)
DBI::dbWriteTable(con, "data2", rawData, overwrite = overwrite)
DBI::dbDisconnect(con)
}