tag:blogger.com,1999:blog-1901659770749170850.post8987401846960239293..comments2018-11-27T06:39:27.023-05:00Comments on Quantitative Ecology: Sample uniformly within a fixed radius.Foresterhttp://www.blogger.com/profile/00291122844817714304noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-1901659770749170850.post-71668835848003005012014-05-17T10:01:49.742-04:002014-05-17T10:01:49.742-04:00Hi Forester,
Thanks for your post! Here's dif...Hi Forester,<br />Thanks for your post! Here's different solution for uniform sampling that's a bit more slipshod (you end up having less control), but I thought you'd be interested in the nature of the solution:<br /><br />Mark<br /><br /><br />df = data.frame(<br />x1 = runif(1000,-1,1),<br />y1 = runif(1000,-1,1)<br />)<br /><br />df$ok = apply(df,1,function(x){as.numeric(x[1]^2 + x[2]^2 < 1)})<br /><br />sub = df[df$ok == 1,]<br /><br />plot(sub$x1, sub$y1)<br />Mark T Pattersonhttps://www.blogger.com/profile/13617500268567880565noreply@blogger.com