[Rd] Small Fix: Greatly Increase Clarity/Utility of R Package Help/Manual Overview Pages

2021-06-29 Thread Marsh, Samuel
?Hi, I would like to suggest a single line (2 characters) fix that I feel would greatly improve the readability and usefulness of the overview R package help/manual pages. Currently the overall help/manual page for a package is organized into alphabetized table of contents with linked headers

Re: [Rd] Small Fix: Greatly Increase Clarity/Utility of R Package Help/Manual Overview Pages

2021-06-29 Thread Sebastian Meyer
Just in case others (like me) don't instantly know what this is about. This only affects the html help. Compare the HTML index page for the base package "graphics" https://stat.ethz.ch/R-manual/R-patched/library/graphics/html/00Index.html with the index page for the base package "grDevices" htt

[Rd] ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread Sebastian Martin Krantz
Hello together, I'm working on some custom (grouped, weighted) sum, min and max functions and I want them to support the special case of plain integer sequences using ALTREP. I thereby encountered some behavior I cannot explain to myself. The head of my fsum C function looks like this (g is optiona

Re: [Rd] [External] ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread luke-tierney
ALTINTEGER_SUM and friends are _not_ intended for use in package code. Once we get some time to clean up headers they will no longer be visible to packages. Best, luke On Tue, 29 Jun 2021, Sebastian Martin Krantz wrote: Hello together, I'm working on some custom (grouped, weighted) sum, min a

Re: [Rd] ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread Bill Dunlap
Adding the dimensions attribute takes away the altrep-ness. Removing dimensions does not make it altrep. E.g., > a <- 1:10 > am <- a ; dim(am) <- c(2L,5L) > amn <- am ; dim(amn) <- NULL > .Call("is_altrep", a) [1] TRUE > .Call("is_altrep", am) [1] FALSE > .Call("is_altrep", amn) [1] FALSE where

Re: [Rd] ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread Sebastian Martin Krantz
Thanks both. Is there a suggested way I can get this speedup in a package? Or just leave it for now? Thanks also for the clarification Bill. The issue I have with that is that in my C code ALTREP(x) evaluates to true even after adding and removing dimensions (otherwise it would be handled by the n

Re: [Rd] [External] Re: ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread luke-tierney
It depends on the size. For a larger vector adding dim will create a wrapper ALTREP. Currently the wrapper does not try to use the payload's sum method; this could be added. Best, luke On Tue, 29 Jun 2021, Bill Dunlap wrote: Adding the dimensions attribute takes away the altrep-ness. Removi

Re: [Rd] [External] Re: ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread luke-tierney
Call the R sum() function, either before going to C code or by calling back into R. You may only want to do this if the vector is long enough for e possible savings to be worth while. On Tue, 29 Jun 2021, Sebastian Martin Krantz wrote: Thanks both. Is there a suggested way I can get this speed

Re: [Rd] ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread Gabriel Becker
Hi Sebastian, So the way that it is currently factored, there isn't a good way of getting what you want under the constraints of what Luke said (ALTINTEGER_SUM is not part of the API). I don't know what his reason are for saying that per say and would not want to speak for him, but of the top of

Re: [Rd] ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread Gabriel Becker
Also, @Luke Tierney I can prepare a patch that has wrappers delegate to payload's ALTREP class methods for things like sum, min, max, etc once conference season calms down a bit. Best, ~G On Tue, Jun 29, 2021 at 11:07 AM Gabriel Becker wrote: > Hi Sebastian, > > So the way that it is currentl

Re: [Rd] ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread Gabriel Becker
Hi Sebastian, min/max do not materialize the vector, you will see it as compact after same as before. It *does* however do a pass over the data chunked by region, which is much more expensive than it need be for compact sequences, that is true. I think in some version of code that never made it o

Re: [Rd] ALTREP ALTINTEGER_SUM/MIN/MAX Return Value and Behavior

2021-06-29 Thread Sebastian Martin Krantz
Thanks Gabriel and Luke, I understand now the functions return NULL if no method is applicable. I wonder though why do ALTINTEGER_MIN and MAX return NULL on a plain integer sequence? I also see that min() and max() are not optimized i.e. min(1:1e8) appears to materialize the vector. In general I