fieldWithPrototype | R Documentation |
A convenience for declaring a default value for a field, in the
vein of prototype
for S4 classes, except
the default value is quoted and evaluated lazily.
fieldWithPrototype(name, class, value)
name |
The name of the field |
class |
The class of the field |
value |
Default value that when evaluated initializes the field |
A list suitable for use with setRefClass
Michael lawrence
Brush.gen <- setRefClass("Brush", fields = fieldWithPrototype("color", "character", "red")) brush <- Brush.gen$new() brush$color brush$color <- "blue" brush$color
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.