Skip to contents

This function loads the external data to the R environment. If the required file is not found locally, it attempts to download the file from author's GitHub. In this package, it is used to download external data from this folder, such as the pre-trained model file, drug annotation file, etc.

Usage

load_data(required_file)

Arguments

required_file

Required file name without extensions from GitHub repo.

Value

The content of the required data.

Details

The function first checks if the required file exists in the labyrinth directory (defined by tools::R_user_dir('labyrinth')). If the required file is not found, it attempts to download the file from GitHub repo up to five times. If the download fails after five attempts, an error is thrown. If the file is successfully downloaded or already exists locally, the function will return the file content.

Examples

if (FALSE) { # \dontrun{
# Load the trained model
model <- load_data("model")

# Load the drug annotation data
drug_annot <- load_data("drug_annot")
} # }