[R] Error in x@coords[i, , drop = FALSE] : subscript out of bounds

2014-06-08 Thread lijiaming
Hi All, I try to empoly Monte Carlo to find out the distribution of my data. The code is following library(sp) library(rgdal) library(raster) x-readOGR(., finance) #get one spatial file N.list-list() for(i in 1:1000){ Sample.x-sample(1:7059,600) #the shp file includes 7059 points£¬and I

Re: [R] Error in x@coords[i, , drop = FALSE] : subscript out of bounds

2014-06-08 Thread Michael Sumner
Compare 7059 with nrow(x). Looks like they do not match, it is best not to hardcode such things. Cheers, Mike On 9 Jun 2014 05:40, lijiaming lijiamingfore...@gmail.com wrote: Hi All, I try to empoly Monte Carlo to find out the distribution of my data. The code is following library(sp)