Skip to contents

This function facilitates the bulk reading of multiple files from the project's designated Google Drive folder. By using cloud_drive_ls, you can obtain a dataframe detailing the contents of the Google Drive folder. Applying cloud_drive_read_bulk to this dataframe allows you to read all listed files into a named list. The function will, by default, infer the appropriate reading method based on each file's extension. However, if a specific reading function is provided via the fun parameter, it will be applied uniformly to all files, which may not be suitable for diverse file types.

Usage

cloud_drive_read_bulk(content, fun = NULL, ..., quiet = FALSE)

Arguments

content

(data.frame) Output of cloud_drive_ls()

fun

A custom reading function. If NULL (default), the appropriate reading function will be inferred based on the file's extension.

...

Additional arguments to pass to the reading function fun.

quiet

All caution messages may be turned off by setting this parameter to TRUE.

Value

A named list where each element corresponds to the content of a file from Google Drive. The names of the list elements are derived from the file names.

Examples

if (FALSE) { # interactive()
# provided there's a folder called "data" in the root of the project's main
# Google Drive folder, and it contains csv files
data_lst <- 
  cloud_drive_ls("data") |> 
  filter(type == "csv") |> 
  cloud_drive_read_bulk()
  
}