s3write_using {aws.s3} | R Documentation |
Custom read and write
Description
Read/write objects from/to S3 using a custom function
Usage
s3write_using(x, FUN, ..., object, bucket, opts = NULL)
s3read_using(FUN, ..., object, bucket, opts = NULL, filename = NULL)
Arguments
x |
For |
FUN |
For |
... |
Additional arguments to |
object |
Character string with the object key, or an object of class “s3_object”. In most cases, if |
bucket |
Character string with the name of the bucket, or an object of class “s3_bucket”. |
opts |
Optional additional arguments passed to |
filename |
Optional string, name of the temporary file that will be created. If not specified, |
Value
For s3write_using
, a logical, invisibly. For s3read_using
, the output of FUN
applied to the file from object
.
See Also
s3saveRDS
, s3readRDS
, put_object
,get_object
Examples
## Not run:
library("datasets")
# create bucket
b <- put_bucket("myexamplebucket")
# save a dataset to the bucket as a csv
if (require("utils")) {
s3write_using(mtcars, FUN = write.csv, object = "mtcars.csv", bucket = b)
}
# load dataset from the bucket as a csv
if (require("utils")) {
s3read_using(FUN = read.csv, object = "mtcars.csv", bucket = b)
}
# cleanup
delete_object(object = "mtcars.csv", bucket = b)
delete_bucket(bucket = b)
## End(Not run)