Hi all,
I recently learned that it is possible for `as.data.frame.matrix()` to
produce a data frame with 0 columns that is also entirely missing a
`names` attribute, and I think this is a bug:
```
# No `names`, weird!
attributes(as.data.frame(matrix(nrow = 0, ncol = 0)))
#> $class
#> [1] "data.fr
Hi all,
I noticed that `expand.grid()` has somewhat inconsistent behavior with
dropping `NULL` inputs. In particular, if there is a leading `NULL`,
then it ends up as a column in the resulting data frame, which seems
pretty undesirable. Also, notice in the last example that `Var3` is
used as the c
function(..., na.rm = FALSE, finite = FALSE)
> .rangeNum(..., na.rm=na.rm, finite=finite, isNumeric = is.numeric)
>
> range.POSIXct <- range.Date <- function(..., na.rm = FALSE, finite = FALSE)
> .rangeNum(..., na.rm=na.rm, finite=finite, isNumeric = function
`finite`. Because `is.numeric.Date()` is
defined, that always returns `FALSE` for Dates (and POSIXt). Because
of that, it may still be easier to just write a specific
`range.Date()` method, but I'm not sure.
-Davis
On Sat, Apr 29, 2023 at 4:47 PM Martin Maechler
wrote:
>
> >>>&g
Hi all,
I noticed that `range.default()` has a nice `finite = TRUE` argument,
but it doesn't actually apply to Date or POSIXct due to how
`is.numeric()` works.
```
x <- .Date(c(0, Inf, 1, 2, Inf))
x
#> [1] "1970-01-01" "Inf""1970-01-02" "1970-01-03" "Inf"
# Darn!
range(x, finite = TRUE)
Hi all,
Surprisingly (at least to me), `as.complex(NA_real_)` results in
`complex(real = NA_real_, imaginary = 0)` rather than `NA_complex_`.
It seems to me that this goes against the docs of `as.complex()`,
which say this in the Details section:
"Up to R versions 3.2.x, all forms of NA and NaN
Hi all,
I've sent in a bugzilla patch for an alternative C algorithm for
`which()` which uses less memory and is often faster in many real life
scenarios. I've documented it in full on the bugzilla page, with many
examples:
https://bugs.r-project.org/show_bug.cgi?id=18495
The short version is tha
Hi all,
I really like the addition of `R_NewEnv()` back in 4.1.0
https://github.com/wch/r-source/blob/625ab8d45f86f65561e53627e1f0c220bdc5f752/src/main/envir.c#L3619-L3630
I have a use case where I'm likely to call this function a large
number of times to generate many small hashed environments,
Hi all,
Writing R Extensions describes `R_NewEnv()` as:
```
At times it may also be useful to create a new environment frame in C
code. R_NewEnv is a C version of the R function new.env:
SEXP R_NewEnv(SEXP enclos, int hash, ins size)
```
There is a typo here where `ins size` should be `int size