[R] A problem about all possible sequences

2007-04-17 Thread Paul Smith
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

Re: [R] A problem about all possible sequences

2007-04-17 Thread Paul Smith
On 4/17/07, Robin Hankin [EMAIL PROTECTED] wrote: f - function(n){expand.grid(rep(list(0:1),n))} f(10) [snip] Thanks, Robin, that is it! Paul 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

Re: [R] A problem about all possible sequences

2007-04-17 Thread Robin Hankin
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

Re: [R] A problem about all possible sequences

2007-04-17 Thread Ted Harding
On 17-Apr-07 14:26:15, 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. You don't say whether the elements of the sequence are

Re: [R] A problem about all possible sequences

2007-04-17 Thread Chuck Cleland
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