I have a vector consisting of zeroes and ones, e.g. 101001.
I would like to pick a random element from this vector equal to one. In the
example above, that means that only elements 1, 3, or 6 can be chosen.
Is there a simple and fast way to do that? (my vector of zeroes and ones is
very large)
Thank you.
---------------------------------------------------------
Oleg Smirnov
Assistant Professor of Political Science
Stony Brook University
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.