Learn R Programming

k5 (version 0.0.5)

write_last: Write the last value to disk

Description

The value of the internal evaluation of a top-level R expression is always assigned to .Last.value before further processing (e.g., printing).

Usage

write_last(file = tempfile(), x = .Last.value, ...)

save_last(file = tempfile(), x = .Last.value, ...)

Value

The created file path, invisibly.

Arguments

file

File or connection to write to.

x

The object to write, usually left as base::.Last.value.

...

Additional arguments passed to the writing function (see Details).

Details

Four types of files are written, based on object class:

  1. For data frames, a tab-separated file via readr::write_tsv().

  2. For vectors, a newline-separated file via readr::write_lines().

  3. For ggplots, a raster image (by default) via ggplot2::ggsave().

  4. For other objects, an uncompressed data file via readr::write_rds().