[R] A problem about all possible sequences
ccleland at optonline.net
Tue Apr 17 16:44:12 CEST 2007
Paul Smith wrote:
> Dear All
> Suppose a sequence of length 10 generated by the following rule: the
> first element is 0 with 50% of probability or 1 with the same
> probability; the second element likewise; and so on.
> Is there some R command to obtain all possible different sequences
> formed by the above rule? I am aware that one could write a small
> program to do that, but I am speculating about whether a command is
> already existent.
levels(interaction(c(0,1), c(0,1), c(0,1), c(0,1),
c(0,1), c(0,1), c(0,1), c(0,1),
c(0,1), c(0,1), sep=""))
> Thanks in advance,
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Chuck Cleland, Ph.D.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894
More information about the R-help