refset (version 0.1.1)

contents: Returns or changes parcel contents

Description

contents returns the value of the parcel contents by evaluating the expression in the parcel. contents<- attempts to assign to the expression, which will only work if the expression is appropriate, e.g. a refset.

Usage

contents(parcel)

contents(parcel) <- value

Arguments

parcel

an object of class 'parcel'

value

a value to assign

Value

The result of evaluating the expression stored in the parcel. For contents<-, the parcel itself.

contents<- will only work if the expression wrapped in the parcel can accept assignments.

See Also

Other wrapping functions: is.parcel, unwrap_as, wrapset, wrap

Examples

Run this code
# NOT RUN {
pcl <- wrap(x^2)
x <- 2
contents(pcl)
x <- 3
contents(pcl)
# }
# NOT RUN {
contents(pcl) <- 4 # fails
# }
# NOT RUN {
p2 <- wrap(names(x))
contents(p2) <- "named"
x

# }

Run the code above in your browser using DataLab