Skip to contents

This function changes the tags of a safeframe object, using the same syntax as the constructor make_safeframe().

Usage

set_tags(x, ...)

Arguments

x

a data.frame or a tibble

...

<dynamic-dots> A named list with variable names in x as list names and the tags as list values. Values set to NULL remove the tag When specifying tags, please also see default_values.

Value

The function returns a safeframe object.

See also

make_safeframe() to create a safeframe object

Examples


## create a safeframe
x <- make_safeframe(cars, speed = "Miles per hour")
tags(x)
#> $speed
#> [1] "Miles per hour"
#> 

## add new tags and fix an existing one
x <- set_tags(x, dist = "Distance")
tags(x)
#> $speed
#> [1] "Miles per hour"
#> 
#> $dist
#> [1] "Distance"
#> 

## remove tags by setting them to NULL
old_tags <- tags(x)
x <- set_tags(x, speed = NULL, dist = NULL)
tags(x)
#> named list()

## setting tags providing a list (used to restore old tags here)
x <- set_tags(x, !!!old_tags)
tags(x)
#> $speed
#> [1] "Miles per hour"
#> 
#> $dist
#> [1] "Distance"
#>