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, ...)
# S4 method for class 'numeric_version'
saveObject(x, path, ...)
x
is saved inside path
.
NULL
is invisibly returned.
readAtomicVector
, to read the files back into the session.
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"