Safe version of saveRDS()
.
If the given save path (i.e. dirname(file_path)
) does not exist, it is created instead of raising an error.
Arguments
- object
R variable or object to save on disk.
- file_path
Path and name of the save file, as a string.
- recursive
Should elements of the path other than the last be created? If
TRUE
, behaves like the Unix commandmkdir -p
.- no_warning
Whether to cancel the warning issued if a directory is created (bool).
Examples
if (FALSE) safe_save_rds(c(1, 2, 8), "./results/my_new_folder/my_vector.rds")