Displaying 4 results from an estimated 4 matches for "index_list".
2018 Jun 08
3
Subsetting the "ROW"s of an object
...m> wrote:
>
> Hmmm, yes, there must be some special case in the C code to avoid
> recycling a length-1 logical vector:
Here is a version that (I think) handles Herve's issue of arrays having one or more 0 dimensions.
subset_ROW <-
function(x,i)
{
dims <- dim(x)
index_list <- which(dims[-1] != 0L) + 3
mc <- quote(x[i])
nd <- max(1L, length(dims))
mc[ index_list ] <- list(TRUE)
mc[[ nd + 3L ]] <- FALSE
names( mc )[ nd+3L ] <- "drop"
eval(mc)
}
Curiously enough the timing is *much* better for this implementation than...
2004 Dec 02
7
A possible way to reduce basic questions
Jim Lemon <bitwrit <at> ozemail.com.au> writes:
> I have been thinking about how to reduce the number of basic questions that
> elicit the ...ahem... robust debate that has occurred about how to answer
The traffic on r-help could be reduced by creating a second list where
more elementary questions are asked.
There may be other ways to partition the universe of questions
2018 Jun 08
0
Subsetting the "ROW"s of an object
...be some special case in the C code to avoid
>> recycling a length-1 logical vector:
>
>
> Here is a version that (I think) handles Herve's issue of arrays having one or more 0 dimensions.
>
> subset_ROW <-
> function(x,i)
> {
> dims <- dim(x)
> index_list <- which(dims[-1] != 0L) + 3
> mc <- quote(x[i])
> nd <- max(1L, length(dims))
> mc[ index_list ] <- list(TRUE)
> mc[[ nd + 3L ]] <- FALSE
> names( mc )[ nd+3L ] <- "drop"
> eval(mc)
> }
>
> Curiously enough the timing i...
2018 Jun 08
4
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 11:52 AM, Hadley Wickham <h.wickham at gmail.com> wrote:
>
> On Fri, Jun 8, 2018 at 11:38 AM, Berry, Charles <ccberry at ucsd.edu> wrote:
>>
>>
>>> On Jun 8, 2018, at 10:37 AM, Herv? Pag?s <hpages at fredhutch.org> wrote:
>>>
>>> Also the TRUEs cause problems if some dimensions are 0:
>>>