search for: useliteral

Displaying 5 results from an estimated 5 matches for "useliteral".

Did you mean: isliteral
2018 Jun 08
3
Subsetting the "ROW"s of an object
...e, ALTREP, support for >> recycling) >> Hadley AFAICS, it is not an issue. Taking arr <- array(rnorm(2^22),c(2^10,4,4,4)) as a test case and using a function that will either use the literal code `x[i,,,,drop=FALSE]' or `eval(mc)': subset_ROW4 <- function(x, i, useLiteral=FALSE) { literal <- quote(x[i,,,,drop=FALSE]) mc <- quote(x[i]) nd <- max(1L, length(dim(x))) mc[seq(4,length=nd-1L)] <- rep(TRUE, nd-1L) mc[["drop"]] <- FALSE if (useLiteral) eval(literal) else eval(mc) } I get identical times...
2018 Jun 08
4
Subsetting the "ROW"s of an object
...an issue. Taking >> >> arr <- array(rnorm(2^22),c(2^10,4,4,4)) >> >> as a test case >> >> and using a function that will either use the literal code `x[i,,,,drop=FALSE]' or `eval(mc)': >> >> subset_ROW4 <- >> function(x, i, useLiteral=FALSE) >> { >> literal <- quote(x[i,,,,drop=FALSE]) >> mc <- quote(x[i]) >> nd <- max(1L, length(dim(x))) >> mc[seq(4,length=nd-1L)] <- rep(TRUE, nd-1L) >> mc[["drop"]] <- FALSE >> if (useLiteral) >> e...
2018 Jun 08
0
Subsetting the "ROW"s of an object
...adley > > > AFAICS, it is not an issue. Taking > > arr <- array(rnorm(2^22),c(2^10,4,4,4)) > > as a test case > > and using a function that will either use the literal code `x[i,,,,drop=FALSE]' or `eval(mc)': > > subset_ROW4 <- > function(x, i, useLiteral=FALSE) > { > literal <- quote(x[i,,,,drop=FALSE]) > mc <- quote(x[i]) > nd <- max(1L, length(dim(x))) > mc[seq(4,length=nd-1L)] <- rep(TRUE, nd-1L) > mc[["drop"]] <- FALSE > if (useLiteral) > eval(literal) > els...
2018 Jun 08
0
Subsetting the "ROW"s of an object
...t;>> arr <- array(rnorm(2^22),c(2^10,4,4,4)) >>> >>> as a test case >>> >>> and using a function that will either use the literal code `x[i,,,,drop=FALSE]' or `eval(mc)': >>> >>> subset_ROW4 <- >>> function(x, i, useLiteral=FALSE) >>> { >>> literal <- quote(x[i,,,,drop=FALSE]) >>> mc <- quote(x[i]) >>> nd <- max(1L, length(dim(x))) >>> mc[seq(4,length=nd-1L)] <- rep(TRUE, nd-1L) >>> mc[["drop"]] <- FALSE >>> if (u...
2018 Jun 08
2
Subsetting the "ROW"s of an object
I suspect this will have suboptimal performance since the TRUEs will get recycled. (Maybe there is, or could be, ALTREP, support for recycling) Hadley On Fri, Jun 8, 2018 at 10:16 AM, Berry, Charles <ccberry at ucsd.edu> wrote: > > >> On Jun 8, 2018, at 8:45 AM, Hadley Wickham <h.wickham at gmail.com> wrote: >> >> Hi all, >> >> Is there a better to