[Rd] logic ops with zero-extent raw vectors

Lukas Stadler lukas.stadler at oracle.com
Wed Sep 27 17:36:15 CEST 2017


Hi,

there was a change concerning logical operations about a year ago:
https://github.com/wch/r-source/commit/9e19d3e3dd5f657b5cfefe562bdd7ede2e2b8786
It's related to a discussion on this list:
https://hypatia.math.ethz.ch/pipermail/r-devel/2016-September/073068.html <https://hypatia.math.ethz.ch/pipermail/r-devel/2016-September/073068.html>

A change in logic.c:134 influences the result type of operations on zero-extent raw vectors.
Old behavior:
> raw(1) & raw(1)
[1] 00
> raw(0) & raw(0)
raw(0)
New behavior:
> raw(1) & raw(1)
[1] 00
> raw(0) & raw(0)
logical(0)

I'm wondering whether the logical result type was intentional, because, to me, the old behavior seems more consistent.

Best,
 Lukas
	[[alternative HTML version deleted]]



More information about the R-devel mailing list