[R] a little probleme
tlumley at u.washington.edu
Wed Jul 4 18:20:14 CEST 2001
On Wed, 4 Jul 2001, Olivier Martin wrote:
> Hi all,
> i would like to find the best way to resolve the following problem.
> Suppoose i have a vector x of length N with k different elements.
> I would like to get a matrix M with k rows and N columns such that:
> in each line i (i=1,...,k), which(x%in%u[i]) is equal to 1 and 0 else.
(the +0 just converts it to numeric rather than TRUE/FALSE)
Thomas Lumley Asst. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help