Skip to contents

Create and save in file stamp for future use

Usage

stamp_save(
  x = NULL,
  st_file = NULL,
  st_dir = NULL,
  st_name = NULL,
  st_ext = getOption("stamp.default.ext"),
  stamp = NULL,
  stamp_set = FALSE,
  replace = FALSE,
  x_attr = FALSE,
  verbose = getOption("stamp.verbose"),
  ...
)

Arguments

x

R object to stamp

st_file

character: path of stamp file to compare with.

st_dir

character: parent directory to store stamp file (see details).

st_name

character: name of stamp in file. All stamp files are prefixed with value in option "stamp.stamp_prefix", which by default is "st_". You don't need to add the prefix.

st_ext

character: format of stamp file to save. Default is value in option "stamp.default.ext"

stamp

list of stamp from stamp_get() in case it was calculated before hand. Developers option. It should be used interactively.

stamp_set

logical: whether to set stamp in .stamp env, using st_name.

replace

Logical: if TRUE and st_name already exists in .stamp environment, it will be replaced with new stamp. If FALSE it gives an error. Default is FALSE

x_attr

logical: whether or not to save the attributes of x along with the stamp. Useful for quick comparisons. Default is FALSE

verbose

logical: Fi TRUE displays information about stamping process.

...

other arguments passed to stamp_get()

Value

TRUE is saved correctly. FALSE otherwise

Details

st_dir is parent directory. It is inside st_dir that stamp creates another subdirectory with name in option "stamp.dir_stamp" and it is in there where the stamps are saved. The idea objective is to have a directory for stamps only. By default, st_dir is the current directory. If last directory name of st_dir is equal to option "stamp.dir_stamp", then st_dir becomes the stamps directory.

st_name must prefixed to avoid overwriting actual data. This is just a precaution that should not present bumps in any workflow. If the beginning of st_name is identical to the value in "stamp.stamp_prefix", then it is adopted as is. Otherwise, the prefix in "stamp.stamp_prefix" will be added to st_name. If NULL, st_name would be a random name of 8 characters.

See also

Other stamp functions: stamp_confirm(), stamp_get(), stamp_read(), stamp_set(), stamp_time(), stamp_x_attr()

Examples

if (FALSE) {

x <- data.frame(a = 1:5,
b = letters[1:5])

st_dir <- tempdir()
st_name <- "xst"
stamp_save(x = x,
st_dir = st_dir,
st_name = st_name)

}