Description Usage Arguments Value Examples
This function is a complement of the print function. It is able to
print an ALTREP object made by AltWrapper package. In case that the
data pointer is not available, the function will look at
ALTREP APIs in the order of getRegion
, getSubset
,
getElement
to search for the available way to collect the data.
1 2 3 4 | ## S3 method for class 'altWrapper'
print(x, ...)
printAltWrapper(x, ...)
|
x |
An altWrapper object |
... |
No effect, for compatibility only |
The argument x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | length_func <- function(x) length(x)
element_function <- function(x,i) x[i]
## Define the altWrapper class and its functions
setAltClass(className = "example", classType = "integer")
setAltMethod(className = "example", getLength = length_func)
setAltMethod(className = "example", getElement = element_function)
## Create an altWrapper object by providing the class name and data.
A <- newAltrep(className = "example", x = 1L:10L)
## The default print function does not wrok since it uses
## data pointer only.
## Not run:
A
## End(Not run)
## The package provide an alternative print function
printAltWrapper(A)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.