contents: Returns or changes parcel contents

Description Usage Arguments Value See Also Examples

View source: R/refset.R

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

1
2
3
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
pcl <- wrap(x^2)
x <- 2
contents(pcl)
x <- 3
contents(pcl)
## Not run: 
contents(pcl) <- 4 # fails

## End(Not run)
p2 <- wrap(names(x))
contents(p2) <- "named"
x

refset documentation built on Dec. 10, 2017, 5:02 p.m.