Paul

f <- function(n){expand.grid(rep(list(0:1),n))}
f(10)
[snip]


HTH

Robin



On 17 Apr 2007, at 15:26, 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.
>
> Thanks in advance,
>
> Paul
>
> ______________________________________________
> [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.

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

______________________________________________
[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.

Reply via email to