The lib_remove
function removes an item from the
data library, and deletes the source file for that data. If the library
is loaded, it will also remove that item from the workspace environment.
lib_remove(x, name)
The library with the requested item removed.
Other lib:
is.lib()
,
lib_add()
,
lib_copy()
,
lib_delete()
,
lib_export()
,
lib_info()
,
lib_load()
,
lib_path()
,
lib_replace()
,
lib_size()
,
lib_sync()
,
lib_unload()
,
lib_write()
,
libname()
,
print.lib()
# Create temp directory
tmp <- tempdir()
# Create library
libname(dat, tmp)
# Add data to the library
lib_add(dat, mtcars, beaver1, iris)
# library 'dat': 3 items
# - attributes: not loaded
# - path: C:\Users\User\AppData\Local\Temp\RtmpCSJ6Gc
# - items:
# Name Extension Rows Cols Size LastModified
# 1 mtcars rds 32 11 7.5 Kb 2020-11-05 19:32:00
# 2 beaver1 rds 114 4 5.1 Kb 2020-11-05 19:32:04
# 3 iris rds 150 5 7.5 Kb 2020-11-05 19:32:08
# Remove items from the library
lib_remove(dat, c("beaver1", "iris"))
# library 'dat': 1 items
# - attributes: not loaded
# - path: C:\Users\User\AppData\Local\Temp\RtmpCSJ6Gc
# - items:
# Name Extension Rows Cols Size LastModified
# 1 mtcars rds 32 11 7.5 Kb 2020-11-05 19:32:40
# Clean up
lib_delete(dat)