What are the differences of `:` and `%in%` in R formula notation?

Viewed 65

Here is the description of these two operators from the doc An Introduction to R:

M_1 : M_2
The tensor product of M_1 and M_2. If both terms are factors, then the “subclasses” factor.

M_1 %in% M_2
Similar to M_1:M_2, but with a different coding.

This does not actually tell the difference between the two. My questions are,

  1. What's the difference between M_1 : M_2 and M_1 %in% M_2 as formula notations, or under what circumstances do we have to use the former or the latter?
  2. What does with a different coding mean in this context?
0 Answers
Related