is.shared: Test whether the object is a shared object

Description Usage Arguments Details Value Examples

Description

Test whether the object is a shared object

Usage

1
2
3
4
is.shared(x, ..., depth = 0, showAttributes = FALSE)

## S4 method for signature 'ANY'
is.shared(x, ..., depth = 0, showAttributes = FALSE)

Arguments

x

An R object

...

For generalization purpose only

depth

Whether to recursively check the element of x if x is a container (e.g. list or environment), see details

showAttributes

Whether to check the attributes of x.

Details

When depth=0, the is.shared function return a single logical value indicating whether x contains any shared objects. When depth>0 and x is a container(e.g. list), the function will recursively check each element of x and return a list with each elements corresponding to the elements in x. The depth of the checking procedure is determined by the depth parameter.

if showAttributes = TRUE, the attributes of the object will also be checked. The result can be find in sharedAttributes attribute. Note that showAttributes has no effect on an S4 object for the attributes of an S4 object are used to store the slots and should not be treated as the attributes of an object.

Value

a single logical value of a list.

Examples

1
2
3
4
5
6
7
x1 <- share(1:10)
is.shared(x1)

x2 <- share(list(a=list(b=1, d=2)))
is.shared(x2, depth=0)
is.shared(x2, depth=1)
is.shared(x2, depth=2)

SharedObject documentation built on Nov. 8, 2020, 8:17 p.m.