Skip to contents

Removes all elements from the container object.

Usage

clear(x)

ref_clear(x)

# S3 method for class 'Container'
clear(x)

# S3 method for class 'Container'
ref_clear(x)

# S3 method for class 'dict.table'
clear(x)

# S3 method for class 'dict.table'
ref_clear(x)

Arguments

x

any R object.

Value

For Container, an object of class Container (or one of the respective derived classes).

For dict.table an object of class dict.table.

Examples


co = container(1, 2, mean)
clear(co)
#> []
co
#> [1, 2, <<function>>]
ref_clear(co)
co
#> []

dit = dict.table(a = 1, b = 2)
clear(dit)
#> <dict.table> with 0 rows and 0 columns
#> Null data.table (0 rows and 0 cols)
dit              # original was not touched
#> <dict.table> with 1 row and 2 columns
#>        a     b
#>    <num> <num>
#> 1:     1     2
ref_clear(dit)
dit              # original was cleared
#> <dict.table> with 0 rows and 0 columns
#> Null data.table (0 rows and 0 cols)