Skip to contents

These functions validate a given file by checking its extension and attempting to load its contents. A file is considered valid if it loads successfully and contains a non-null object, returning TRUE. Otherwise, it returns FALSE.

Usage

check_data(file, warning = TRUE, n_threads = 5)

check_RData(file, warning = TRUE)

check_qs(file, warning = TRUE, n_threads = 5)

check_rds(file, warning = TRUE)

check_feather(file, warning = TRUE)

Arguments

file

Character. The path to the file to be checked. Cannot be empty.

warning

Logical. If TRUE (default), warnings will be printed if the file does not exist.

n_threads

Integer. The number of threads to use when reading qs2 files. Default is 5.

Value

Logical. TRUE if the file is valid, otherwise FALSE.

Details

The check_data() function determines the file type based on its extension. If the extension is unrecognized, it returns FALSE. Supported file types:

  • RData: Checked with check_RData(), read using load_as

  • qs2: Checked with check_qs(), read using qs2::qs_read

  • rds: Checked with check_rds(), read using readRDS

  • feather: Checked with check_feather(), read using arrow::read_feather

Author

Ahmed El-Gabbas