drug_element
returns list of tibbles of drugs selected
elements.
drug_element(
elements_options = c("all"),
save_table = FALSE,
save_csv = FALSE,
csv_path = ".",
override_csv = FALSE,
database_connection = NULL
)
list, options of elements to be parsed. default is "all"
boolean, save table in database if true.
boolean, save csv version of parsed tibble if true
location to save csv files into it, default is current location, save_csv must be true
override existing csv, if any, in case it is true in the new parse operation
DBI connection object that holds a connection to
user defined database. If save_table
is enabled without providing
value for this function an error will be thrown.
@return list of selected drug elements tibbles
this functions extracts selected element of drug nodes in DrugBank
xml database with the option to save it in a predefined database via
passed database connection. it takes two optional arguments to
save the returned tibble in the database save_table
and
database_connection
.
it must be called after read_drugbank_xml_db
function like
any other parser function.
if read_drugbank_xml_db
is called before for any reason, so
no need to call it again before calling this function.
drug_element_options can be called to know the valid options for this method
Other common:
drug_all()
,
drug_element_options()
# NOT RUN {
# return only the parsed tibble
drug_element()
# will throw an error, as database_connection is NULL
drug_element(save_table = TRUE)
# save parsed tibble as csv if it does not exist in current location and
# return parsed tibble.
# if the csv exist before read it and return its data.
drug_element(save_csv = TRUE)
sqlite_con <- DBI::dbConnect(RSQLite::SQLite())
drug_element(save_table = TRUE, database_connection = sqlite_con)
# save in database, save parsed tibble as csv if it does not
# exist in current location and return parsed tibble.
# if the csv exist before read it and return its data.
drug_element(save_table = TRUE, save_csv = TRUE,
database_connection = sqlite_con)
# save parsed tibble as csv if it does not exist in given location and
# return parsed tibble.
# if the csv exist before read it and return its data.
drug_element(save_csv = TRUE, csv_path = TRUE)
# save parsed tibble as csv if it does not exist in current
# location and return parsed tibble.
# if the csv exist override it and return it.
drug_element(save_csv = TRUE, csv_path = TRUE, override = TRUE)
drug_element(c("drug_ahfs_codes", "drug_carriers"), save_table = TRUE)
drug_element(save_table = FALSE)
drug_element(c("drug_ahfs_codes", "drug_carriers"))
# }
Run the code above in your browser using DataLab