One of the tasks of design_matrix() (aka model_matrix()) is to identify terms with common missingness patterns, so as to avoid storing the same information in two places. Some of the operations would be more succinct if they used duplicated.matrix(..., margin=2) to identify replicate columns of the data frame that is cast but not stored here --
null.record <- rowSums(as.data.frame(ccs.by.term))==0
-- rather than applying duplicated.default() to a list. They may well also be more efficient; the duplicated() help page bears a "Warning" reading:
Using this for lists is potentially slow, especially if the
elements are not atomic vectors (see ‘vector’) or differ only in
their attributes. In the worst case it is O(n^2).
One of the tasks of
design_matrix()(akamodel_matrix()) is to identify terms with common missingness patterns, so as to avoid storing the same information in two places. Some of the operations would be more succinct if they usedduplicated.matrix(..., margin=2)to identify replicate columns of the data frame that is cast but not stored here ---- rather than applying
duplicated.default()to a list. They may well also be more efficient; theduplicated()help page bears a "Warning" reading: