Learn R Programming

aws.s3 (version 0.2.2)

s3saveRDS: saveRDS/readRDS

Description

Serialization interface to read/write R objects to S3

Usage

s3saveRDS(x, bucket, object = paste0(as.character(substitute(x)), ".rds"),
  ...)

s3readRDS(bucket, object, ...)

Arguments

x
For s3saveRDS, a single R object to be saved via saveRDS and uploaded to S3. x is analogous to the object argument in saveRDS.
bucket
Character string with the name of the bucket, or an object of class “s3_bucket”.
object
Character string with the object key, or an object of class “s3_object”. In most cases, if object is specified as the latter, bucket can be omitted because the bucket name will be extracted from “Bucket” slot in object.
Additional arguments passed to s3HTTP.

Value

For s3saveRDS, a logical. For s3readRDS, an R object.

See Also

s3save,s3load

Examples

Run this code
## Not run: ------------------------------------
# # create bucket
# b <- put_bucket("myexamplebucket")
# 
# # save a single object to s3
# s3saveRDS(x = mtcars, bucket = "myexamplebucket", object = "mtcars.rds")
# 
# # restore it under a different name
# mtcars2 <- s3readRDS(object = "mtcars.rds", bucket = "myexamplebucket")
# identical(mtcars, mtcars2)
# 
# # cleanup
# delete_object(object = "mtcars.rds", bucket = "myexamplebucket")
# delete_bucket("myexamplebucket")
## ---------------------------------------------

Run the code above in your browser using DataLab