data2db: Write data into a database

View source: R/data2db.R

data2dbR Documentation

Write data into a database

Description

Write data into a database

Usage

data2db(
  tname,
  db,
  file,
  sep = "rds",
  overwrite = FALSE,
  cutoff = 0,
  directed = FALSE,
  title = NULL,
  note = ""
)

Arguments

tname

string. The table name of the data. A table name can contain numeric alphabets and underline (e.g. table_1 ). The table name should begin with an alphabet. The 8 table names below are specified: * "edge": matrix data for network. * "dict_cui": dict of cui nodes. * "dict_codified": dict of codified nodes. * "synonyms": synonyms of cui nodes. * "rollup": rollup for cui nodes. * some other names can't be used: "details", "ids", "node".

db

string. The database path to write to. e.g. "./test.db".

file

string. The file path to read from. rds, csv, tsv, txt will be OK.

sep

string. Default "rds" or single character used to separate fields within a record (e.g. "\t" ",", "|", ";").

overwrite

logical. Default FALSE. If TRUE, The existing table will be overwrite.

cutoff

float. Default 0. Parameter for "edge" data. The cutoff for matrix data of network.

directed

logical. Default FALSE. Parameter for "edge" data. If TRUE, the edge of the network will be with arrow. Not currently available.

title

string. Default NULL. Parameter for more data. The title for more information data.

note

string. Default "". Parameter for more data. The description for more information data.

Value

A sqlite3 database.

Examples

## Not run: 
saveRDS(data.frame("from" = 1:3, "to" = 4:6, "weight" = 7:9), "test_data2db.rds")
data2db("edge", "test_data2db.db", "test_data2db.rds")

## End(Not run)

chenh2017/parsenetwork documentation built on Sept. 24, 2022, 3:52 a.m.