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, character.vls = FALSE, ...)

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

# S4 method for class 'logical'
saveObject(x, path, character.vls = FALSE, ...)

# S4 method for class 'double'
saveObject(x, path, character.vls = FALSE, ...)

# S4 method for class 'numeric'
saveObject(x, path, character.vls = FALSE, ...)

# S4 method for class 'Date'
saveObject(x, path, character.vls = FALSE, ...)

# S4 method for class 'POSIXlt'
saveObject(x, path, character.vls = FALSE, ...)

# S4 method for class 'POSIXct'
saveObject(x, path, character.vls = FALSE, ...)

# S4 method for class 'numeric_version'
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.

character.vls

Logical scalar indicating whether to save character vectors in the custom variable length string (VLS) array format. If NULL, this is determined based on a comparison of the expected storage against a fixed length array.

...

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/_environment.json" "bar/contents.h5"      
#> [4] "foo/OBJECT"            "foo/_environment.json" "foo/contents.h5"