The approaches assoc
and cos
are described in detail in assocSparse
and cosSparse
, respectively. Those methods are extended here in case either the columns (.col
) or the rows (.row
) form groups. Specifically, this occurs with sparse encoding of nominal variables (see splitTable
). In such encoding, the different values of a nominal variable are encoded in separate columns. However, these columns cannot be treated independently, but have to be treated as groups.
The .col
methods should be used when similarities between the different values of nominal variables are to be computed. The .row
methods should be used when similarities between the observations of nominal variables are to be computed.
Note that the calculations of the assoc
functions really only makes sense for binary data (i.e. matrices with only ones and zeros). Currently, all input is coerced to such data by as(X, "nMatrix")*1
, meaning that all values that are not one or zero are turned into one (including negative values!).