rm_bytag {tagr}R Documentation

Remove Objects by Tag

Description

Remove all objects in the current environment that have a specified tag.

Usage

rm_bytag(
  tag,
  envir = parent.frame(),
  confirm = getOption("tagsr.confirm", FALSE)
)

Arguments

tag

The tag to search for.

envir

The environment to search in. Defaults to the current environment.

confirm

If TRUE, a confirmation prompt will be displayed before objects are deleted.

Value

No return value.

See Also

add_tags, has_tag, ls_bytag

Examples

# create some objects with tags
x <- 1:10
y <- matrix(rnorm(16), 4, 4)
add_tags(x, "numbers")
add_tags(y, "matrix")

# remove all objects with the "numbers" tag
rm_bytag("numbers")

# remove all objects with the "matrix" tag without confirmation prompt
set_confirm(FALSE)
rm_bytag("matrix")

# confirm that objects have been removed
ls()

# clean up
rm(set_confirm, x, y)


[Package tagr version 1.0.1 Index]