Skip to content
Prev 61258 / 63424 Next

Recycling in arithmetic operations involving zero-length vectors

Dear R-core,

The language definition is very clear:

"As from R 1.4.0, any arithmetic operation involving a zero-length 
vector has a zero-length result."

Thus, `1 + numeric()` returns `numeric(0)`. However, I don't find this 
very intuitive because usually the shorter vector is recycled to the 
length of the longer vector. Would it be possible to throw at least a 
warning for such cases? I don't expect them to be intended by most users.

Best regards,