Retrieves a file from the workspace bucket and moves it into the current persistent disk where it can be read into R, e.g., using a function like read.csv().
Usage
aou_bucket_to_workspace(
file,
directory = FALSE,
bucket = getOption("aou.default.bucket")
)
Arguments
- file
The name of a file in your bucket, a vector of multiple files, a directory, or a file pattern (e.g. ".csv").
- directory
Whether
file
refers to an entire directory you want to move.- bucket
Bucket to retrieve file from. Defaults to
getOption("aou.default.bucket")
, which isSys.getenv('WORKSPACE_BUCKET')
unless specified otherwise.
Details
This function retrieves a file from your bucket and moves it into
your workspace where it can be read into R, e.g., using a function like
write.csv()
. See
https://cloud.google.com/storage/docs/gsutil/commands/cp for details on
the underlying function.
Examples
if (FALSE) { # on_workbench()
# save a file to the bucket
tmp <- tempdir()
write.csv(data.frame(x = 1), file.path(tmp, "testdata.csv"))
aou_workspace_to_bucket(file.path(tmp, "testdata.csv"))
# read the file back into the workspace
aou_bucket_to_workspace("testdata.csv")
# read in to your local environment
read.csv("testdata.csv")
}