Return the appropriate function for writing the supplied object to disk
object_fn.RdReturn the appropriate function for writing the supplied object to disk
Details
data.frame/matrixwrite_featherggplotggsaveanything elsesaveRDS
See also
Other file IO:
col_types(),
dep_read(),
dep_write(),
dir_fn(),
dirs,
ext(),
file_fn(),
is_filepath(),
last_updated(),
list.files2(),
load_obj(),
make_names(),
mkpath(),
move_files_to_folder(),
needs_update(),
object_write(),
package_size(),
write_dir_fn(),
write_lines()
Examples
object_fn(1:15)
#> function (object, file = "", ascii = FALSE, version = NULL, compress = TRUE,
#> refhook = NULL)
#> {
#> if (is.character(file)) {
#> if (length(file) != 1 || file == "")
#> stop(gettextf("'%s' must be a non-empty string",
#> "file"), domain = NA)
#> object <- object
#> mode <- if (ascii %in% FALSE)
#> "wb"
#> else "w"
#> con <- if (is.logical(compress))
#> if (compress)
#> gzfile(file, mode)
#> else file(file, mode)
#> else switch(compress, bzip2 = bzfile(file, mode), xz = xzfile(file,
#> mode), gzip = gzfile(file, mode), stop("invalid 'compress' argument: ",
#> compress))
#> on.exit(close(con))
#> }
#> else if (inherits(file, "connection")) {
#> if (!missing(compress))
#> warning("'compress' is ignored unless 'file' is a file name")
#> con <- file
#> }
#> else stop("bad 'file' argument")
#> .Internal(serializeToConn(object, con, ascii, version, refhook))
#> }
#> <bytecode: 0x55c89a9e1dc8>
#> <environment: namespace:base>