These functions access or modify the "wmisc" attribute of an R object. The attribute is typically used to store metadata in wmisc-compatible structures.

get_wmisc_attributes(x)

set_wmisc_attributes(x, ...)

Arguments

x

An R object (usually a list) from or to which the "wmisc" attribute is accessed or modified.

...

Named values to add or update in the "wmisc" attribute.

Value

get_wmisc_attributes() returns the "wmisc" attribute of x, or NULL if none is present. set_wmisc_attributes() returns x with the updated "wmisc" attribute.

Details

  • get_wmisc_attributes() extracts and returns the "wmisc" attribute. Returns NULL if it does not exist.

  • set_wmisc_attributes() adds or updates entries in the "wmisc" attribute. If a name occurs multiple times, the last value is retained.

See also

Examples

obj <- list(a = 1, b = 2)
obj <- set_wmisc_attributes(obj, key1 = "value1", key2 = "value2")
get_wmisc_attributes(obj)
#> $key1
#> [1] "value1"
#> 
#> $key2
#> [1] "value2"
#> 
obj <- set_wmisc_attributes(obj, key1 = "new_value1", key3 = "value3")
get_wmisc_attributes(obj)
#> $key1
#> [1] "value1"
#> 
#> $key2
#> [1] "value2"
#> 
#> $key3
#> [1] "value3"
#>