ExposeAttribute: Exposing Object Attributes

View source: R/utils.R

ExposeAttributeR Documentation

Exposing Object Attributes

Description

The function ExposeAttribute creates an S3 object that exposes all attributes of any R object, by making them accessible via methods $ and/or $<-.

Usage

ExposeAttribute(object, ..., .MODE = "rw", .VALUE = FALSE)

attr_mode(x)

attr_mode(x) <- value

Arguments

object

any R object whose attributes need to be exposed

...

attributes, and optionally their respective values or access permissions. See argument value of attr_mode for details on the way of specifying these.

.MODE

access mode:

“r”:

(read-only) only method $ is defined

“w”:

(write-only) only method $<- is defined

“rw”:

(read-write) both methods $ and $<- are defined

.VALUE

logical that indicates if the values of named arguments in ... should be considered as attribute assignments, i.e. that the result object has these attributes set with the specified values. In this case all these attributes will have the access permission as defined by argument .MODE.

x

an ExposeAttribute object

value

replacement value for mode. It can be NULL to remove the ExposeAttribute wrapper, a single character string to define a permission for all atributes (e.g., 'rw' or 'r'), or a list specifying access permission for specific attributes or classes of attributes defined by regular expressions. For example, list(a='r', b='w', `blabla.*`='rw') set attribute 'a' as read-only, attribute 'b' as write-only, all attributes that start with 'blabla' in read-write access.

Value

ExposeAttribute returns an S3 object of class ExposeAttribute.


renozao/pkgmaker documentation built on May 3, 2023, 6:04 p.m.