setSlots | R Documentation |
This function is used by some of the programmatically generated to fill in slots in an R object. The main use is when copying fields in a reference to a structure into an R object with slots paralleling the fields in the struct. This occurs in the coercion method from an external pointer to an R class paralleling the C-level struct.
setSlots(els, obj)
els |
a named list of the elements to be copied into the corresponding slots |
obj |
the R object to be populated and assumed to have the appropriate slots |
obj
, with the relevant slots assigned values from els
Duncan Temple Lang
The package RGCCTUFFI
(https://github.com/omegahat/RGCCTUFFI) has a related
defStructClass
function.
setClass("foo", representation(a = "integer",
b = "character",
d = "data.frame"))
i = new("foo")
i = setSlots(list(b = "a string", d = mtcars), i)
i = setSlots(list(a = 10L), i)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.