s3store: Store an R object in S3 by key.

Description Usage Arguments Details Note See Also Examples

View source: R/s3store.r

Description

Any type of object that can be serialized as an RDS file is capable of being retrieved using this interface.

Usage

1
2
3
s3store(obj, name = NULL, path = s3path(), safe = FALSE, ...)

s3put(..., safe = TRUE)

Arguments

obj

ANY. An R object to save to S3.

name

character. The S3 key to save to. If no key is provided, the expression passed as obj will be used.

path

character. The S3 prefix, e.g., "s3://yourbucket/some/path/".

safe

logical. Whether or not to overwrite existing fails by default or error if they exist.

...

additional arguments to s3mpi:::s3.put.

Details

If you wish to store non-vanilla R objects, such as those containing external pointers to C structures, see s3normalize.

Note

s3put is equivalent to s3store except that it will fail by default if you try to overwrite an existing key.

See Also

s3read

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
s3store(c(1,2,3), 'test123')
print(s3read('test123'))
# [1] 1 2 3

s3store(function(x, y) { x + 2 * y }, "myfunc")
stopifnot(s3read("myfunc")(1, 2) == 5) # R can serialize closures!

obj <- 1:5
s3store(obj) # If we do not pass a key the path is inferred from
  # the expression using deparse(substitute(...)).
stopifnot(all.equal(s3read("obj"), 1:5))

## End(Not run)

robertzk/s3mpi documentation built on May 27, 2019, 11:37 a.m.