The last statement of the following code produces a warning -- is this intentional?
> d <- data.frame(a=1)
> d[integer(), ]
> d[integer(), "a"]
> d[integer(), "a"] <- 2
In max(i) : no non-missing arguments to max; returning -Inf
Empty vectors of row indexes can arise when using which() on an all-FALSE selection vector. To me, the warning is misleading; it seems odd to require a special treatment of this corner case from the user, and using suppressWarnings() could mute other, desired, warnings.
I apologize if this has come up before, but I was unable to find anything related on the web.
It was doing needless calculations in that case: I guess the author never considered anyone would do that.
Confirmed. Thanks for the quick fix.