| props | R Documentation |
props(x) returns all properties.
props(x) <- list(name1 = val1, name2 = val2) modifies an existing object
by setting multiple properties simultaneously.
set_props(x, name1 = val1, name2 = val2) creates a copy of an existing
object with new values for the specified properties.
props(object, names = prop_names(object))
props(object, check = TRUE) <- value
set_props(`_object`, ..., .check = TRUE)
object |
An object from a S7 class |
names |
A character vector of property names to retrieve. Default is all properties. |
check, .check |
If |
value |
A named list of values. The object is checked for validity only after all replacements are performed. |
_object |
The object to modify. |
... |
Name-value pairs given property to modify and new value. As a convenience, you can supply a single unnamed list instead of individual name-value pairs, which makes it easy to set properties programmatically. |
A named list of property values.
Horse := new_class(properties = list(
name = class_character,
colour = class_character,
height = class_numeric
))
lexington <- Horse(colour = "bay", height = 15, name = "Lex")
props(lexington)
props(lexington) <- list(height = 14, name = "Lexington")
lexington
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.