Description Usage Arguments Value Examples
View source: R/altWrapper-main.R
This function make an altWrapper object from an altWrapper class
specified by the class name. The altWrapper class can
be set via setAltClass
and setAltMethod
functions.
1 2 |
className |
Character, the name of an altWrapper class |
x |
The data of the returned altWrapper object |
attributes |
Named list, attributes that will be attached to the object. The
attribute |
S3Class |
Logical or character vector, whether the return value is of an altWrapper S3 class. If the argument is a character vector, it will overwrite the default settings and resulting in an S3 object with the class type specified in the character vector. |
S4Class |
Logical or character, whether the return value is of
an AltWrapper S4 class. If the argument is a character, it must be a class name and
the return value is an S4 object specified by the class name.
An error will be returned if both |
An ALTREP vector
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Define the ALTREP functions
length_func <- function(x) length(x)
get_ptr_func <- function(x,writeable) x
## Define the altWrapper class and its functions
setAltClass(className = "example", classType = "integer")
setAltMethod(className = "example", getLength = length_func)
setAltMethod(className = "example", getDataptr = get_ptr_func)
## Create an altWrapper object by providing the class name and data.
A <- newAltrep(className = "example", x = 1L:10L)
A
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.