Skip to content
Prev 55313 / 63424 Next

Subsetting the "ROW"s of an object

You can use TRUE to fill the subscripts for dimensions 2:nd
subset_ROW <-
    function(x,i)
{
    mc <- quote(x[i])
    nd <- max(1L, length(dim(x)))
    mc[seq(4, length=nd-1L)] <- rep(list(TRUE), nd - 1L)
    mc[["drop"]] <- FALSE
    eval(mc)
    
}
HTH,

Chuck