## Not run: ------------------------------------
# library("datasets")
#
# # write file to S3
# tmp <- tempfile()
# on.exit(unlink(tmp))
# utils::write.csv(mtcars, file = tmp)
# put_object(tmp, object = "mtcars.csv", bucket = "myexamplebucket")
#
# # write serialized, in-memory object to S3
# x <- rawConnection(raw(0), "w")
# utils::write.csv(mtcars, x)
# put_object(rawConnectionValue(x), object = "mtcars.csv", bucket = "myexamplebucketname")
#
# # alternative "S3 URI" syntax:
# put_object(rawConnectionValue(x), object = "s3://myexamplebucketname/mtcars.csv")
# close(x)
#
# # read the object back from S3
# read.csv(text = rawToChar(get_object(object = "s3://myexamplebucketname/mtcars.csv")))
## ---------------------------------------------
Run the code above in your browser using DataLab