Something along the lines of

x <- 1:5
sample(x = x, size = 100, replace = TRUE, prob = x^2)


?

Cheers,
Roman



On Fri, Aug 26, 2011 at 9:50 PM, Oscar Galli <ogalli@dinara.gub.uy> wrote:

> I have to write code to build a numeric vector with 20 elements and sample
> elements of the vector such that the probability that an item is taken to be
> proportional to the square of that value.
>
> As I estimate the probability?
>
> Cheers, Oscar
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



-- 
In God we trust, all others bring data.

	[[alternative HTML version deleted]]

