assignment-immutable: Intercept assignment operations for "immutable" S3 objects.

assignment-immutableR Documentation

Intercept assignment operations for "immutable" S3 objects.

Description

Prevents modification of objects labelled with the "immutable" S3-class by intercepting assignment during S3-method dispatch and returning an error.

Usage

\method{subset}{immutable}(object, ...) <- value

## S3 replacement method for class 'immutable'
object[...] <- value

## S3 replacement method for class 'immutable'
object[[...]] <- value

## S3 replacement method for class 'immutable'
object$... <- value

## S3 replacement method for class 'immutable'
names(x) <- value

## S3 replacement method for class 'immutable'
dimnames(x) <- value

\method{colnames}{immutable}(x) <- value

\method{rownames}{immutable}(x) <- value

Arguments

object, x

An R object inherting from the "immutable" S3-class.

...

Catch subset arguments for various dimensions.

value

Not used.

Value

None, throws an error.

Examples

immutable_df <- immutable(data.frame(a=1:5, b=letters[1:5]))
# return immutable data.frame
immutable_df[1:4, ]
# return immutable vector
immutable_df$a


bhklab/CoreGx documentation built on March 14, 2024, 3:04 a.m.