Learn R Programming

dbparser (version 1.1.1)

drug_atc_codes: Extracts the drug atc codes element and return data as tibble.

Description

drug_atc_codes returns tibble of drug atc codes elements.

Usage

drug_atc_codes(
  save_table = FALSE,
  save_csv = FALSE,
  csv_path = ".",
  override_csv = FALSE,
  database_connection = NULL
)

Arguments

save_table

boolean, save table in database if true.

save_csv

boolean, save csv version of parsed tibble if true

csv_path

location to save csv files into it, default is current location, save_csv must be true

override_csv

override existing csv, if any, in case it is true in the new parse operation

database_connection

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.

Value

drug atc_codes node attributes date frame

Details

This functions extracts the atc codes element of drug node 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.

See Also

Other drugs: drug_affected_organisms(), drug_ahfs_codes(), drug_articles(), drug_books(), drug_calc_prop(), drug_categories(), drug_classification(), drug_dosages(), drug_ex_identity(), drug_exp_prop(), drug_external_links(), drug_food_interactions(), drug_groups(), drug_interactions(), drug_intern_brand(), drug_links(), drug_manufacturers(), drug_mixtures(), drug_packagers(), drug_patents(), drug_pdb_entries(), drug_products(), drug_salts(), drug_snp_adverse_reactions(), drug_snp_effects(), drug_syn(), drug()

Examples

Run this code
# NOT RUN {
# return only the parsed tibble
drug_atc_codes()

# will throw an error, as database_connection is NULL
drug_atc_codes(save_table = TRUE)

# save in database in SQLite in memory database and return parsed tibble
sqlite_con <- DBI::dbConnect(RSQLite::SQLite())
drug_atc_codes(save_table = TRUE, database_connection = sqlite_con)

# 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_atc_codes(save_csv = TRUE)

# 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_atc_codes(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_atc_codes(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_atc_codes(save_csv = TRUE, csv_path = TRUE, override = TRUE)
# }

Run the code above in your browser using DataLab