[R] proportional sampling

jim holtman jholtman at gmail.com
Fri Apr 27 14:20:23 CEST 2007


sample(df$ID, numOfTime, replace=TRUE, prob=df$Factor)

On 4/27/07, tibi.codilean at ges.gla.ac.uk <tibi.codilean at ges.gla.ac.uk> wrote:
> Dear All,
>
> I wonder if you could help me.
>
> I have a table with a series of sites that I would like to sample from.
> The table has 5 columns:
>
> ID
> X Coordinate
> Y Coordinate
> Value
> Factor
>
>
> The conditions are that each site can be selected more than once and the
> probability of it being selected (or sampled) is proportional to a factor
> located in column 'Factor'
>
> I am novice in terms of R, and am not entirely sure how to do the
> proportional sampling.
>
> Any help would be appreciated
> Thanks
> Tibi
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list