Define inner as in:
http://tolstoy.newcastle.edu.au/R/e4/help/08/08/19562.html
and use that with identical to define an inner product:
m <- matrix(c(1, 2, 1, 2, 3, 2), 2) # test matrix
m
colSums(inner(m, u <- unique(m,,2), identical))
u
Please provide actual code to create test examples and expe
maybe there's a much simpler way to do this but here's what I got:
> z
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]114444
[2,]225555
[3,]336666
> z.unique<-unique(z,MARGIN=2)
> z.unique
[,1] [,2]
[1,]14
[2,]25
One way is to 'paste' together the values in a column and then use
'table' to count them.
'duplicated' can probably do the same thing with the MARGIN option to
find the duplicated one. You still them have to find the original
ones.
On Sat, Nov 22, 2008 at 3:42 PM, Salas, Andria Kay <[EMAIL PROTE
I need help determining the unique columns of a matrix and the numbers of each
unique column. For example, let's say I have a matrix with 6 columns, 2 of
these are filled with the value of 1 and the other 4 are filled with the value
of 0. I would then like to have a command that tells me what
4 matches
Mail list logo