Unconditional processing warnings

I will start my question by recalling what “recycling” is, and for this I will bring another user (question: “Brian Diggs” about Implementing standard disposal rules ):

One nice feature of R related to its inherent vectorized nature is the disposal rule described in Introduction to R in Section 2.2.

Vectors found in the same expression need not be the same length. If this is not the case, the value of the expression is a vector with the same length as the longest vector that occurs in the expression. Shorter vectors in the expression are processed as often as necessary (possibly fractionally) until they match the length of the longest vector. In particular, the constant is simply repeated.

I would agree that recycling is a great opportunity, and it makes life easier. But I know many people who also consider this dangerous, and I see their point of view: sometimes it would be nice if R could warn you when, for example, you are trying to add a vector to the matrix, because this is not the most natural thing.

My question is: is it possible to send R warnings with every reuse?

Currently, R will warn only when longer object length is not a multiple of shorter object length . I would like something that warns in all cases. I looked through options but no luck.

+6
source share

Source: https://habr.com/ru/post/909245/


All Articles