Description Usage Arguments Value Examples
View source: R/altWrapper-main.R
Define an altWrapper class by specifying its name and data type
1 2 | setAltClass(className, classType = c("raw", "logical", "integer",
"double"))
|
className |
Character, the name of the class |
classType |
Character, the type of the altWrapper |
No return value
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.