Main function that downloads several SPATA2 objects at the same time and saves each as an .RDS file.

downloadSpataObjects(
  sample_names,
  files = NULL,
  folder = base::getwd(),
  overwrite = FALSE,
  adjust_link = TRUE,
  timeout = 600,
  verbose = TRUE,
  ...
)

Arguments

sample_names

Character vector. The sample names of the SPATA2 objects to be downloaded. Use validSampleNames() to obtain all valid input options.

files

Character vector or NULL. Specifies the file names under which the SPATA2 objects are saved. If character, the input must be of the same length as the input for argument sample_names. If NULL, the files are named according to the sample name.

folder

Character value. If character, specifies the output folder in which the SPATA2 object is saved. Defaults to the working directory.

overwrite

Logical. Must be set to TRUE if file directories under which downloaded files are to be saved already exist.

Logical value. Defaults to TRUE. Allows the function to adjust the link if the download fails due to Google Drive warnings. See section below for more information.

timeout

Numeric value. Indicates the number of seconds the function has time to download the object before the process is aborted. Defaults to 600s (10min).

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

Value

An invisible TRUE.

Google Drive Warning

SPATA2 objects are stored in a Google Drive repository and downloaded via their weblink as stored in the source data.frame. Often, SPATA2 objects are too large for the automatic Google Drive virus scan. As a result, the weblink initially leads to a webpage that asks if you are okay with skipping this virus scan.

In cases where the Google Drive link leads to this warning page, the function will automatically adjust the download link to bypass the warning and attempt the download again. If the adjusted download still fails, an error message is displayed, prompting the user to manually download the file using the provided link.

Since the virus scan cannot be performed by Google Drive regardless of whether you download it from within R or manually, the function defaults to bypass this warning automatically. If you prefer not to bypass the warning, you can set adjust_link = FALSE. In this case, the function will give a warning and ask you to download the object manually.

The downloaded objects do not contain viruses. The way they have been created, uploaded as well as how the web links are added to the source data.frame can be reconstructed with the populate_ scripts provided on the SPATAData repository on github under /scripts/.

Examples

# downloads three objects and
# saves them as "spata_objects/UKF275T.RDS", "spata_objects/UKF313t.RDS", ... etc.

  downloadSpataObjects(
    sample_names = c("UKF275T", "UKF313T", "UKF334T"),
    folder = "spata_objects" # the folder in which to save the files
   )