search for: orig_class

Displaying 4 results from an estimated 4 matches for "orig_class".

2018 Sep 03
2
True length - length(unclass(x)) - without having to call unclass()?
...::setattr(x, "class", NULL) > ? # get the length > ? len <- base::length(x) > ? # re-set original classes > ? data.table::setattr(x, "class", cls) > ? # return the unclassed length > ? len > } > > # to check that we do not make unwanted changes > orig_class <- class(x) > > # check that the address in RAM does not change > a1 <- data.table::address(x) > > # 'unclassed' length > stopifnot(.length(x) == 2L) > > # check that address is the same > stopifnot(a1 == data.table::address(x)) > > # check against ori...
2018 Sep 01
0
True length - length(unclass(x)) - without having to call unclass()?
...py, but modifies by reference data.table::setattr(x, "class", NULL) # get the length len <- base::length(x) # re-set original classes data.table::setattr(x, "class", cls) # return the unclassed length len } # to check that we do not make unwanted changes orig_class <- class(x) # check that the address in RAM does not change a1 <- data.table::address(x) # 'unclassed' length stopifnot(.length(x) == 2L) # check that address is the same stopifnot(a1 == data.table::address(x)) # check against original class stopifnot(identical(orig_class, class(x...
2018 Aug 24
5
True length - length(unclass(x)) - without having to call unclass()?
Is there a low-level function that returns the length of an object 'x' - the length that for instance .subset(x) and .subset2(x) see? An obvious candidate would be to use: .length <- function(x) length(unclass(x)) However, I'm concerned that calling unclass(x) may trigger an expensive copy internally in some cases. Is that concern unfounded? Thxs, Henrik
2018 Sep 03
0
True length - length(unclass(x)) - without having to call unclass()?
...t;> # get the length >> len <- base::length(x) >> # re-set original classes >> data.table::setattr(x, "class", cls) >> # return the unclassed length >> len >> } >> >> # to check that we do not make unwanted changes >> orig_class <- class(x) >> >> # check that the address in RAM does not change >> a1 <- data.table::address(x) >> >> # 'unclassed' length >> stopifnot(.length(x) == 2L) >> >> # check that address is the same >> stopifnot(a1 == data.table::addre...