Re: [R] Vector with zeros and ones

2013-04-22 Thread Marc Schwartz
On Apr 22, 2013, at 6:28 PM, Marc Schwartz wrote: > On Apr 22, 2013, at 6:21 PM, Ayyappa wrote: > >> Dear group, >> >> I want to generate a vector of 10 elements that always has 20% zeroes, but >> with a random ordering of zeroes and ones. Can you please suggest a function >> to do that in

Re: [R] Vector with zeros and ones

2013-04-22 Thread Marc Schwartz
On Apr 22, 2013, at 6:21 PM, Ayyappa wrote: > Dear group, > > I want to generate a vector of 10 elements that always has 20% zeroes, but > with a random ordering of zeroes and ones. Can you please suggest a function > to do that in R? I tried 'sample' function but the 20% zeros was not always

Re: [R] Vector with zeros and ones

2013-04-22 Thread R. Michael Weylandt
On Mon, Apr 22, 2013 at 7:21 PM, Ayyappa wrote: > Dear group, > > I want to generate a vector of 10 elements that always has 20% zeroes, but > with a random ordering of zeroes and ones. Can you please suggest a function > to do that in R? I tried 'sample' function but the 20% zeros was not alway