search for: setaltmethod

Displaying 3 results from an estimated 3 matches for "setaltmethod".

2019 Jul 18
0
ALTREP wrappers and factors
...ber. The simplest example would be *CODE* ``` library(AltWrapper) inspectFunc <- function(x) cat("Altrep object\n") lengthFunc <- function(x) return(length(x)) getPtrFunc <- function(x, writeable) return(x) setAltClass(className = "test", classType = "real") setAltMethod(className = "test", inspect = inspectFunc) setAltMethod(className = "test", getLength = lengthFunc) setAltMethod(className = "test", getDataptr = getPtrFunc) A = runif(6) A_alt = makeAltrep(className = "test", x = A, *attributes = list(dim = c(2, 3))*) ``` *...
2019 Jul 17
2
ALTREP wrappers and factors
Hello, I?m experimenting with ALTREP and was wondering if there is a preferred way to create an ALTREP wrapper vector without using .Internal(wrap_meta(?)), which R CMD check doesn?t like since it uses an .Internal() function. I was trying to create a factor that used an ALTREP integer, but attempting to set the class and levels attributes always ended up duplicating and materializing the
2019 Aug 12
1
ALTREP package interaction with testthat
...is AltWrapper. My ALTREP serialize function is called even when I'm trying to serialize a non-ALTREP object. Here is an example ``` context("altrep") length_func<-function(x){ return(length(x)) } setAltClass(className = "test", classType = "real") setAltMethod(className = "test", getLength = length_func) testData = runif(10) myAltrep = makeAltrep("test", testData) test_that("Auto serialize", { browser() A = 10 A_serialized=serialize(A,NULL) B = new.env() B_serialized=serialize(B,NULL) }) ```...