[R] Compact Indicator Matrices
Douglas Bates
bates at stat.wisc.edu
Sun May 11 15:47:10 CEST 2008
On Sat, May 10, 2008 at 5:27 AM, amarkos <amarkos at gmail.com> wrote:
> An indicator matrix is a binary matrix with orthogonal columns whose
> rows sum to 1. A row of this matrix could be [0 1 0 0]. My problem is
> to group the similar rows (profiles) so that to create a compact form
> of the matrix.
I'm not sure exactly what you mean by a compact form of this matrix.
Do you mean that you want to collapse similar rows into a single row
and perhaps a count of the number of times that this row occurs?
In R indicator matrices are typically generated from a factor and
essentially you are asking for the tabulation of the factor, such as
provided by the functions table and xtabs.
> Is there an R function that deals with this problem or do I have to
> write it from scratch?
>
> Thanks,
> Angelos Markos
> Dr. Applied Informatics,
> University of Macedonia, Greece
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list