Save vectors containing atomic elements (or values that can be cast as such, e.g., dates and times) to an on-disk representation.

# S4 method for class 'integer'
saveObject(x, path, ...)

# S4 method for class 'character'
saveObject(x, path, ...)

# S4 method for class 'logical'
saveObject(x, path, ...)

# S4 method for class 'double'
saveObject(x, path, ...)

# S4 method for class 'numeric'
saveObject(x, path, ...)

# S4 method for class 'Date'
saveObject(x, path, ...)

# S4 method for class 'POSIXlt'
saveObject(x, path, ...)

# S4 method for class 'POSIXct'
saveObject(x, path, ...)

Arguments

x

Any of the atomic vector types, or Date objects, or time objects, e.g., POSIXct.

path

String containing the path to a directory in which to save x.

...

Further arguments that are ignored.

Value

x is saved inside path. NULL is invisibly returned.

See also

readAtomicVector, to read the files back into the session.

Author

Aaron Lun

Examples

tmp <- tempfile()
dir.create(tmp)
saveObject(LETTERS, file.path(tmp, "foo"))
saveObject(setNames(runif(26), letters), file.path(tmp, "bar"))
list.files(tmp, recursive=TRUE)
#> [1] "bar/OBJECT"      "bar/contents.h5" "foo/OBJECT"      "foo/contents.h5"