randsample.fn=function(data,area1,area2,N){ #area1 is the area of observed plot, area2 is the area of expected plot
r1=sqrt(area1/pi)
r2=sqrt(area2/pi)
expplot=data.frame()
for (j in 1:N){
R=runif(1,0,r1-r2)
theta=runif(1,0,360)
xa=R*sin(theta*pi/180)
ya=R*cos(theta*pi/180)
expdata=data[sqrt((data$x-xa)^2+(data$y-ya)^2)<r2,]
lable=paste("plot",j,sep="")
expdata[,6]=lable
colnames(expdata)[6]="plot"
expplot=rbind(expplot,expdata)
}
return(expplot)
}


雷达卡

,问题如下:我有一个调查样圆,面积是1000平米(半径约17.8米),调查了样圆里所有的树木,记录了每个树木到圆心的距离和偏角(树木到圆心的连线与正北方向的夹角),然后我要在这个1000平米样圆里随机抽10个100平米的样圆,返回每个100平米样圆里的所有树木信息,请问在R里如何实现,谢谢!!非常感谢!!



京公网安备 11010802022788号







