search for: extractrow

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

Did you mean: extractrows
2018 Jun 08
1
Subsetting the "ROW"s of an object
On 06/08/2018 10:15 AM, Michael Lawrence wrote: > There probably should be an abstraction for this. In S4Vectors, we > have extractROWS(). FWIW the code in S4Vectors that does what your subset_ROW() does is: https://github.com/Bioconductor/S4Vectors/blob/04cc9516af986b30445e99fd1337f13321b7b4f6/R/subsetting-utils.R#L466-L476 (This is the default "extractROWS" method.) Except for the normalization of 'i', it...
2018 Jun 08
6
Subsetting the "ROW"s of an object
Hi all, Is there a better to way to subset the ROWs (in the sense of NROW) of an vector, matrix, data frame or array than this? subset_ROW <- function(x, i) { nd <- length(dim(x)) if (nd <= 1L) { x[i] } else { dims <- rep(list(quote(expr = )), nd - 1L) do.call(`[`, c(list(quote(x), quote(i)), dims, list(drop = FALSE))) } } subset_ROW(1:10, 4:6) #> [1] 4 5 6
2018 Jun 08
0
Subsetting the "ROW"s of an object
There probably should be an abstraction for this. In S4Vectors, we have extractROWS(). Michael On Fri, Jun 8, 2018 at 8:45 AM, Hadley Wickham <h.wickham at gmail.com> wrote: > Hi all, > > Is there a better to way to subset the ROWs (in the sense of NROW) of > an vector, matrix, data frame or array than this? > > subset_ROW <- function(x, i) { > n...