Dimitris Rizopoulos schrieb:
sorry, my previous answer was not correct; you need:
x <- matrix(c(1,0,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0, 1,0,0),
ncol = 3, byrow = TRUE)
which(t(x == 1), arr.ind = TRUE)[, "row", drop = FALSE]
Dear helpeRs,
I would like to use this thread for a proposal which lingered in my head
for quite a while. Several years ago I was an APL aficionado and I very
much liked the idea of an APL idiom list (see e.g
http://www.pyr.fi/apl/texts/Idiot.htm).
Looking at the solution of Dimitris Rizopoulos wouldn't it be nice not to
have it disappear in the archives? To be explicit I would like to
propose an R idiom list. If there does exist one please forgive my
ignorance.
Best regards
Dietrich
--
Dietrich Trenkler c/o Universitaet Osnabrueck
Rolandstr. 8; D-49069 Osnabrueck, Germany
email: [EMAIL PROTECTED]
______________________________________________
R-help@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.