From peter@|@ng|e|der @end|ng |rom gm@||@com  Fri May 13 04:08:34 2022
From: peter@|@ng|e|der @end|ng |rom gm@||@com (Peter Langfelder)
Date: Thu, 12 May 2022 19:08:34 -0700
Subject: [Rd] hist.default for long vectors
Message-ID: <CA+hbrhUBqcP9m6P9jm7i74VU2feH=+PLavVZ9qoVOb6DSZthtQ@mail.gmail.com>

Hi all,

this may have been noticed/discussed before but my search came up
empty, so here it is: hist.default throws a (somewhat cryptic) error
when trying to call it on a long vector. The error is

invalid length(x)

and is thrown because lines 4 and 5 or so are

n <- length(x <- x[is.finite(x)])
n <- as.integer(n)

Would adapting hist.default for long vectors be as simple as removing
the as.integer line, or is there other code that depends on n being
representable as a 4-byte integer? I see a 'call' to C_BinCount which
I briefly skimmed and it seems to be ready for long vectors (uses
R_xlen_t for indexing variables). Anything else I am missing?

While we're at it, anyone aware of a hist alternative that can handle
long vectors?

Thanks,

Peter



[Rd] hist.default for long vectors
Peter Langfelder