Pretty much as it says, let's save a base R factor to an on-disk representation.
# S4 method for class 'factor'
saveObject(x, path, ...)x is saved inside path.
NULL is invisibly returned.
readBaseFactor, to read the files back into the session.
tmp <- tempfile()
saveObject(factor(1:10, 1:30), tmp)
list.files(tmp, recursive=TRUE)
#> [1] "OBJECT" "_environment.json" "contents.h5"