The lib_copy
function copies a data library. The
function accepts a library and a destination path. If the destination
path does not exist, the function will attempt to create it.
Note that the copy will result in the current data in memory written to the new destination directory. If the library is loaded into the workspace, the workspace version will be considered the most current version, and that is the version that will be copied.
lib_copy(x, nm, directory_path, standard_eval = FALSE)
x | The library to copy. |
---|---|
nm | The variable name to hold the new library.
The parameter will assume non-standard
(unquoted) evaluation unless the |
directory_path | The path to copy the library to. |
standard_eval | A TRUE or FALSE value which indicates whether to
use standard (quoted) or non-standard (unquoted) evaluation on the
|
The new library.
Other lib:
is.lib()
,
lib_add()
,
lib_delete()
,
lib_export()
,
lib_info()
,
lib_load()
,
lib_path()
,
lib_remove()
,
lib_replace()
,
lib_size()
,
lib_sync()
,
lib_unload()
,
lib_write()
,
libname()
,
print.lib()
# Create temp directory tmp <- tempdir() # Create library libname(dat1, tmp) # Add dat to library lib_add(dat1, mtcars, iris) # Copy dat1 to dat2 lib_copy(dat1, dat2, file.path(tmp, "copy")) # library 'dat2': 2 items # - attributes: not loaded # - path: C:\Users\User\AppData\Local\Temp\RtmpCSJ6Gc/copy # - items: # Name Extension Rows Cols Size LastModified # 1 mtcars rds 32 11 7.5 Kb 2020-11-05 21:14:54 # 2 iris rds 150 5 7.5 Kb 2020-11-05 21:14:54 # Clean up lib_delete(dat1) lib_delete(dat2)