S7_data {S7}R Documentation

Get/set underlying "base" data

Description

When an S7 class inherits from an existing base type, it can be useful to work with the underlying object, i.e. the S7 object stripped of class and properties.

Usage

S7_data(object)

S7_data(object, check = TRUE) <- value

Arguments

object

An object from a S7 class

check

If TRUE, check that value is of the correct type and run validate() on the object before returning.

value

Object used to replace the underlying data.

Value

S7_data() returns the data stored in the base object; ⁠S7_data<-()⁠ is called for its side-effects and returns object invisibly.

Examples

text <- new_class("text", parent = class_character)
y <- text(c(foo = "bar"))
y
S7_data(y)

S7_data(y) <- c("a", "b")
y

[Package S7 version 0.1.1 Index]