search for: subset_row4

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

Did you mean: subset_row
2018 Jun 08
4
Subsetting the "ROW"s of an object
...gt;> >> >> 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...
2018 Jun 08
3
Subsetting the "ROW"s of an object
...recycled. (Maybe there is, or could be, 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...
2018 Jun 08
0
Subsetting the "ROW"s of an object
...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[[&qu...
2018 Jun 08
0
Subsetting the "ROW"s of an object
...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 (useLitera...
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