Re: [R] how to select an element from a vector based on a probability

2014-04-11 Thread Simone Gabbriellini
efer to www.vestas.com/legal/notice > If you have received this e-mail in error please contact the sender. > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] >> On Behalf Of Nordlund, Dan (DSHS/RDA) >> Sent: 10. april

Re: [R] how to select an element from a vector based on a probability

2014-04-10 Thread Frede Aakmann Tøgersen
:59 AM > > To: Rui Barradas > > Cc: r-help@r-project.org > > Subject: Re: [R] how to select an element from a vector based on a > > probability > > > > Hello, Rui, > > > > it does, indeed! > > > > thanks, > > Simone > > > >

Re: [R] how to select an element from a vector based on a probability

2014-04-10 Thread Boris Steipe
rdlund, Dan (DSHS/RDA) escreveu: >>> -Original Message- >>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >>> project.org] On Behalf Of Simone Gabbriellini >>> Sent: Thursday, April 10, 2014 11:59 AM >>> To: Rui Barradas >>>

Re: [R] how to select an element from a vector based on a probability

2014-04-10 Thread Rui Barradas
...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Simone Gabbriellini Sent: Thursday, April 10, 2014 11:59 AM To: Rui Barradas Cc: r-help@r-project.org Subject: Re: [R] how to select an element from a vector based on a probability Hello, Rui, it does, indeed! thanks, Simone 20

Re: [R] how to select an element from a vector based on a probability

2014-04-10 Thread Rui Barradas
: Re: [R] how to select an element from a vector based on a probability Hello, Rui, it does, indeed! thanks, Simone 2014-04-10 20:55 GMT+02:00 Rui Barradas : Hello, Use ?sample. sample(x, 1, prob = x) Just be aware that, in using this method, the probability of selection of a particular

Re: [R] how to select an element from a vector based on a probability

2014-04-10 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Simone Gabbriellini > Sent: Thursday, April 10, 2014 11:59 AM > To: Rui Barradas > Cc: r-help@r-project.org > Subject: Re: [R] how to select an element fro

Re: [R] how to select an element from a vector based on a probability

2014-04-10 Thread Simone Gabbriellini
Hello, Rui, it does, indeed! thanks, Simone 2014-04-10 20:55 GMT+02:00 Rui Barradas : > Hello, > > Use ?sample. > > sample(x, 1, prob = x) > > Hope this helps, > > Rui Barradas > > Em 10-04-2014 19:49, Simone Gabbriellini escreveu: > >> Hello List, >> >> I have an array like: >> >> c(4, 3, 5, 4,

Re: [R] how to select an element from a vector based on a probability

2014-04-10 Thread Rui Barradas
Hello, Use ?sample. sample(x, 1, prob = x) Hope this helps, Rui Barradas Em 10-04-2014 19:49, Simone Gabbriellini escreveu: Hello List, I have an array like: c(4, 3, 5, 4, 2, 2, 2, 4, 2, 6, 6, 7, 5, 5, 5, 10, 10, 11, 10, 12, 10, 11, 9, 12, 10, 36, 35, 36, 36, 36, 35, 35, 36, 37, 35, 35, 38

[R] how to select an element from a vector based on a probability

2014-04-10 Thread Simone Gabbriellini
Hello List, I have an array like: c(4, 3, 5, 4, 2, 2, 2, 4, 2, 6, 6, 7, 5, 5, 5, 10, 10, 11, 10, 12, 10, 11, 9, 12, 10, 36, 35, 36, 36, 36, 35, 35, 36, 37, 35, 35, 38, 35, 38, 36, 37, 36, 36, 37, 36, 35, 35, 36, 36, 35, 35, 36, 35, 38, 35, 35, 35, 36, 35, 35, 35, 6, 5, 8, 6, 6, 7, 1, 7, 7, 8, 9,