Examples for 'rlang::is_copyable'


Is an object copyable?

Aliases: is_copyable

Keywords: internal

### ** Examples

# Let's add attributes with structure() to uncopyable types. Since
# they are not copied, the attributes are changed in place:
env <- env()
structure(env, foo = "bar")
<environment: 0x55ccfea10510>
attr(,"foo")
[1] "bar"
env
<environment: 0x55ccfea10510>
attr(,"foo")
[1] "bar"
# These objects that can only be changed with side effect are not
# copyable:
is_copyable(env)
[1] FALSE
structure(base::list, foo = "bar")
function (...)  .Primitive("list")
attr(,"foo")
[1] "bar"
str(base::list)
function (...)  
 - attr(*, "foo")= chr "bar"

[Package rlang version 1.1.4 Index]