Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.59 KB | None | 0 0
  1. # Load libraries ----------------------------------------------------------
  2.  
  3. library(raster)
  4. library(sf)
  5. library(dplyr)
  6. require(data.table)
  7. #require(lidR)
  8.  
  9. df1 = fread(file = '~/data/points/test.csv',na.strings = '')
  10.  
  11. colSums(is.na(df1))
  12.  
  13. pts <- df1[,c("X", "Y",'id')]
  14.  
  15. r = raster(ncol=36000, nrow=18000, vals=1)
  16. # get cell numbers
  17. cells <- cellFromXY(r, pts)
  18. # pick one point per cell
  19. sel <- aggregate(pts, list(cells), function(i)i[1])
  20. gc()
  21. pts = sel[,c("X", "Y",'id')]
  22.  
  23. #shift raster
  24. r = raster::shift(r, .1*xres(r), .9*yres(r))
  25. cells <- cellFromXY(r, pts)
  26. sel <- aggregate(pts, list(cells), function(i)i[1])
  27. pts = sel[,c("X", "Y",'id')]
  28.  
  29. r = raster::shift(r, .15*xres(r), .95*yres(r))
  30. cells <- cellFromXY(r, pts)
  31. sel <- aggregate(pts, list(cells), function(i)i[1])
  32. pts = sel[,c("X", "Y",'id')]
  33.  
  34. r = raster::shift(r, .9*xres(r), .1*yres(r))
  35. cells <- cellFromXY(r, pts)
  36. sel <- aggregate(pts, list(cells), function(i)i[1])
  37. pts = sel[,c("X", "Y",'id')]
  38.  
  39. r = raster::shift(r, .95*xres(r), .15*yres(r))
  40. cells <- cellFromXY(r, pts)
  41. sel <- aggregate(pts, list(cells), function(i)i[1])
  42. pts = sel[,c("X", "Y",'id')]
  43.  
  44. r = raster::shift(r, .1*xres(r), .8*yres(r))
  45. cells <- cellFromXY(r, pts)
  46. sel <- aggregate(pts, list(cells), function(i)i[1])
  47. pts = sel[,c("X", "Y",'id')]
  48.  
  49. r = raster::shift(r, .15*xres(r), .85*yres(r))
  50. cells <- cellFromXY(r, pts)
  51. sel <- aggregate(pts, list(cells), function(i)i[1])
  52. pts = sel[,c("X", "Y",'id')]
  53.  
  54. r = raster::shift(r, .8*xres(r), .1*yres(r))
  55. cells <- cellFromXY(r, pts)
  56. sel <- aggregate(pts, list(cells), function(i)i[1])
  57. pts = sel[,c("X", "Y",'id')]
  58.  
  59. r = raster::shift(r, .85*xres(r), .15*yres(r))
  60. cells <- cellFromXY(r, pts)
  61. sel <- aggregate(pts, list(cells), function(i)i[1])
  62. pts = sel[,c("X", "Y",'id')]
  63.  
  64. r = raster::shift(r, .1*xres(r), .7*yres(r))
  65. cells <- cellFromXY(r, pts)
  66. sel <- aggregate(pts, list(cells), function(i)i[1])
  67. pts = sel[,c("X", "Y",'id')]
  68.  
  69. r = raster::shift(r, .15*xres(r), .75*yres(r))
  70. cells <- cellFromXY(r, pts)
  71. sel <- aggregate(pts, list(cells), function(i)i[1])
  72. pts = sel[,c("X", "Y",'id')]
  73.  
  74. r = raster::shift(r, .7*xres(r), .1*yres(r))
  75. cells <- cellFromXY(r, pts)
  76. sel <- aggregate(pts, list(cells), function(i)i[1])
  77. pts = sel[,c("X", "Y",'id')]
  78.  
  79. r = raster::shift(r, .75*xres(r), .15*yres(r))
  80. cells <- cellFromXY(r, pts)
  81. sel <- aggregate(pts, list(cells), function(i)i[1])
  82. pts = sel[,c("X", "Y",'id')]
  83.  
  84. r = raster::shift(r, .1*xres(r), .6*yres(r))
  85. cells <- cellFromXY(r, pts)
  86. sel <- aggregate(pts, list(cells), function(i)i[1])
  87. pts = sel[,c("X", "Y",'id')]
  88.  
  89. r = raster::shift(r, .15*xres(r), .65*yres(r))
  90. cells <- cellFromXY(r, pts)
  91. sel <- aggregate(pts, list(cells), function(i)i[1])
  92. pts = sel[,c("X", "Y",'id')]
  93.  
  94. r = raster::shift(r, .6*xres(r), .1*yres(r))
  95. cells <- cellFromXY(r, pts)
  96. sel <- aggregate(pts, list(cells), function(i)i[1])
  97. pts = sel[,c("X", "Y",'id')]
  98.  
  99. r = raster::shift(r, .65*xres(r), .15*yres(r))
  100. cells <- cellFromXY(r, pts)
  101. sel <- aggregate(pts, list(cells), function(i)i[1])
  102. pts = sel[,c("X", "Y",'id')]
  103.  
  104. r = raster::shift(r, .1*xres(r), .5*yres(r))
  105. cells <- cellFromXY(r, pts)
  106. sel <- aggregate(pts, list(cells), function(i)i[1])
  107. pts = sel[,c("X", "Y",'id')]
  108.  
  109. r = raster::shift(r, .15*xres(r), .55*yres(r))
  110. cells <- cellFromXY(r, pts)
  111. sel <- aggregate(pts, list(cells), function(i)i[1])
  112. pts = sel[,c("X", "Y",'id')]
  113.  
  114. r = raster::shift(r, .5*xres(r), .1*yres(r))
  115. cells <- cellFromXY(r, pts)
  116. sel <- aggregate(pts, list(cells), function(i)i[1])
  117. pts = sel[,c("X", "Y",'id')]
  118.  
  119. r = raster::shift(r, .55*xres(r), .15*yres(r))
  120. cells <- cellFromXY(r, pts)
  121. sel <- aggregate(pts, list(cells), function(i)i[1])
  122. pts = sel[,c("X", "Y",'id')]
  123.  
  124. r = raster::shift(r, .1*xres(r), .4*yres(r))
  125. cells <- cellFromXY(r, pts)
  126. sel <- aggregate(pts, list(cells), function(i)i[1])
  127. pts = sel[,c("X", "Y",'id')]
  128.  
  129. r = raster::shift(r, .15*xres(r), .45*yres(r))
  130. cells <- cellFromXY(r, pts)
  131. sel <- aggregate(pts, list(cells), function(i)i[1])
  132. pts = sel[,c("X", "Y",'id')]
  133.  
  134. r = raster::shift(r, .4*xres(r), .1*yres(r))
  135. cells <- cellFromXY(r, pts)
  136. sel <- aggregate(pts, list(cells), function(i)i[1])
  137. pts = sel[,c("X", "Y",'id')]
  138.  
  139. r = raster::shift(r, .45*xres(r), .15*yres(r))
  140. cells <- cellFromXY(r, pts)
  141. sel <- aggregate(pts, list(cells), function(i)i[1])
  142. pts = sel[,c("X", "Y",'id')]
  143.  
  144. r = raster::shift(r, .1*xres(r), .3*yres(r))
  145. cells <- cellFromXY(r, pts)
  146. sel <- aggregate(pts, list(cells), function(i)i[1])
  147. pts = sel[,c("X", "Y",'id')]
  148.  
  149. r = raster::shift(r, .15*xres(r), .35*yres(r))
  150. cells <- cellFromXY(r, pts)
  151. sel <- aggregate(pts, list(cells), function(i)i[1])
  152. pts = sel[,c("X", "Y",'id')]
  153.  
  154. r = raster::shift(r, .3*xres(r), .1*yres(r))
  155. cells <- cellFromXY(r, pts)
  156. sel <- aggregate(pts, list(cells), function(i)i[1])
  157. pts = sel[,c("X", "Y",'id')]
  158.  
  159. r = raster::shift(r, .35*xres(r), .15*yres(r))
  160. cells <- cellFromXY(r, pts)
  161. sel <- aggregate(pts, list(cells), function(i)i[1])
  162. pts = sel[,c("X", "Y",'id')]
  163.  
  164. r = raster::shift(r, .1*xres(r), .2*yres(r))
  165. cells <- cellFromXY(r, pts)
  166. sel <- aggregate(pts, list(cells), function(i)i[1])
  167. pts = sel[,c("X", "Y",'id')]
  168.  
  169. r = raster::shift(r, .15*xres(r), .25*yres(r))
  170. cells <- cellFromXY(r, pts)
  171. sel <- aggregate(pts, list(cells), function(i)i[1])
  172. pts = sel[,c("X", "Y",'id')]
  173.  
  174. r = raster::shift(r, .2*xres(r), .1*yres(r))
  175. cells <- cellFromXY(r, pts)
  176. sel <- aggregate(pts, list(cells), function(i)i[1])
  177. pts = sel[,c("X", "Y",'id')]
  178.  
  179. r = raster::shift(r, .25*xres(r), .15*yres(r))
  180. cells <- cellFromXY(r, pts)
  181. sel <- aggregate(pts, list(cells), function(i)i[1])
  182. pts = sel[,c("X", "Y",'id')]
  183.  
  184. r = raster::shift(r, .1*xres(r), .1*yres(r))
  185. cells <- cellFromXY(r, pts)
  186. sel <- aggregate(pts, list(cells), function(i)i[1])
  187. pts = sel[,c("X", "Y",'id')]
  188.  
  189. r = raster::shift(r, .15*xres(r), .15*yres(r))
  190. cells <- cellFromXY(r, pts)
  191. sel <- aggregate(pts, list(cells), function(i)i[1])
  192. pts = sel[,c("X", "Y",'id')]
  193.  
  194. r = raster::shift(r, .1*xres(r), .1*yres(r))
  195. cells <- cellFromXY(r, pts)
  196. sel <- aggregate(pts, list(cells), function(i)i[1])
  197. pts = sel[,c("X", "Y",'id')]
  198.  
  199. r = raster::shift(r, .15*xres(r), .15*yres(r))
  200. cells <- cellFromXY(r, pts)
  201. sel <- aggregate(pts, list(cells), function(i)i[1])
  202. pts = sel[,c("X", "Y",'id')]
  203.  
  204. r = raster::shift(r, .2*xres(r), .9*yres(r))
  205. cells <- cellFromXY(r, pts)
  206. sel <- aggregate(pts, list(cells), function(i)i[1])
  207. pts = sel[,c("X", "Y",'id')]
  208.  
  209. r = raster::shift(r, .25*xres(r), .95*yres(r))
  210. cells <- cellFromXY(r, pts)
  211. sel <- aggregate(pts, list(cells), function(i)i[1])
  212. pts = sel[,c("X", "Y",'id')]
  213.  
  214. r = raster::shift(r, .9*xres(r), .2*yres(r))
  215. cells <- cellFromXY(r, pts)
  216. sel <- aggregate(pts, list(cells), function(i)i[1])
  217. pts = sel[,c("X", "Y",'id')]
  218.  
  219. r = raster::shift(r, .95*xres(r), .25*yres(r))
  220. cells <- cellFromXY(r, pts)
  221. sel <- aggregate(pts, list(cells), function(i)i[1])
  222. pts = sel[,c("X", "Y",'id')]
  223.  
  224. r = raster::shift(r, .2*xres(r), .8*yres(r))
  225. cells <- cellFromXY(r, pts)
  226. sel <- aggregate(pts, list(cells), function(i)i[1])
  227. pts = sel[,c("X", "Y",'id')]
  228.  
  229. r = raster::shift(r, .25*xres(r), .85*yres(r))
  230. cells <- cellFromXY(r, pts)
  231. sel <- aggregate(pts, list(cells), function(i)i[1])
  232. pts = sel[,c("X", "Y",'id')]
  233.  
  234. r = raster::shift(r, .8*xres(r), .2*yres(r))
  235. cells <- cellFromXY(r, pts)
  236. sel <- aggregate(pts, list(cells), function(i)i[1])
  237. pts = sel[,c("X", "Y",'id')]
  238.  
  239. r = raster::shift(r, .85*xres(r), .25*yres(r))
  240. cells <- cellFromXY(r, pts)
  241. sel <- aggregate(pts, list(cells), function(i)i[1])
  242. pts = sel[,c("X", "Y",'id')]
  243.  
  244. r = raster::shift(r, .2*xres(r), .7*yres(r))
  245. cells <- cellFromXY(r, pts)
  246. sel <- aggregate(pts, list(cells), function(i)i[1])
  247. pts = sel[,c("X", "Y",'id')]
  248.  
  249. r = raster::shift(r, .25*xres(r), .75*yres(r))
  250. cells <- cellFromXY(r, pts)
  251. sel <- aggregate(pts, list(cells), function(i)i[1])
  252. pts = sel[,c("X", "Y",'id')]
  253.  
  254. r = raster::shift(r, .7*xres(r), .2*yres(r))
  255. cells <- cellFromXY(r, pts)
  256. sel <- aggregate(pts, list(cells), function(i)i[1])
  257. pts = sel[,c("X", "Y",'id')]
  258.  
  259. r = raster::shift(r, .75*xres(r), .25*yres(r))
  260. cells <- cellFromXY(r, pts)
  261. sel <- aggregate(pts, list(cells), function(i)i[1])
  262. pts = sel[,c("X", "Y",'id')]
  263.  
  264. r = raster::shift(r, .2*xres(r), .6*yres(r))
  265. cells <- cellFromXY(r, pts)
  266. sel <- aggregate(pts, list(cells), function(i)i[1])
  267. pts = sel[,c("X", "Y",'id')]
  268.  
  269. r = raster::shift(r, .25*xres(r), .65*yres(r))
  270. cells <- cellFromXY(r, pts)
  271. sel <- aggregate(pts, list(cells), function(i)i[1])
  272. pts = sel[,c("X", "Y",'id')]
  273.  
  274. r = raster::shift(r, .6*xres(r), .2*yres(r))
  275. cells <- cellFromXY(r, pts)
  276. sel <- aggregate(pts, list(cells), function(i)i[1])
  277. pts = sel[,c("X", "Y",'id')]
  278.  
  279. r = raster::shift(r, .65*xres(r), .25*yres(r))
  280. cells <- cellFromXY(r, pts)
  281. sel <- aggregate(pts, list(cells), function(i)i[1])
  282. pts = sel[,c("X", "Y",'id')]
  283.  
  284. r = raster::shift(r, .2*xres(r), .5*yres(r))
  285. cells <- cellFromXY(r, pts)
  286. sel <- aggregate(pts, list(cells), function(i)i[1])
  287. pts = sel[,c("X", "Y",'id')]
  288.  
  289. r = raster::shift(r, .25*xres(r), .55*yres(r))
  290. cells <- cellFromXY(r, pts)
  291. sel <- aggregate(pts, list(cells), function(i)i[1])
  292. pts = sel[,c("X", "Y",'id')]
  293.  
  294. r = raster::shift(r, .5*xres(r), .2*yres(r))
  295. cells <- cellFromXY(r, pts)
  296. sel <- aggregate(pts, list(cells), function(i)i[1])
  297. pts = sel[,c("X", "Y",'id')]
  298.  
  299. r = raster::shift(r, .55*xres(r), .25*yres(r))
  300. cells <- cellFromXY(r, pts)
  301. sel <- aggregate(pts, list(cells), function(i)i[1])
  302. pts = sel[,c("X", "Y",'id')]
  303.  
  304. r = raster::shift(r, .2*xres(r), .4*yres(r))
  305. cells <- cellFromXY(r, pts)
  306. sel <- aggregate(pts, list(cells), function(i)i[1])
  307. pts = sel[,c("X", "Y",'id')]
  308.  
  309. r = raster::shift(r, .25*xres(r), .45*yres(r))
  310. cells <- cellFromXY(r, pts)
  311. sel <- aggregate(pts, list(cells), function(i)i[1])
  312. pts = sel[,c("X", "Y",'id')]
  313.  
  314. r = raster::shift(r, .4*xres(r), .2*yres(r))
  315. cells <- cellFromXY(r, pts)
  316. sel <- aggregate(pts, list(cells), function(i)i[1])
  317. pts = sel[,c("X", "Y",'id')]
  318.  
  319. r = raster::shift(r, .45*xres(r), .25*yres(r))
  320. cells <- cellFromXY(r, pts)
  321. sel <- aggregate(pts, list(cells), function(i)i[1])
  322. pts = sel[,c("X", "Y",'id')]
  323.  
  324. r = raster::shift(r, .2*xres(r), .3*yres(r))
  325. cells <- cellFromXY(r, pts)
  326. sel <- aggregate(pts, list(cells), function(i)i[1])
  327. pts = sel[,c("X", "Y",'id')]
  328.  
  329. r = raster::shift(r, .25*xres(r), .35*yres(r))
  330. cells <- cellFromXY(r, pts)
  331. sel <- aggregate(pts, list(cells), function(i)i[1])
  332. pts = sel[,c("X", "Y",'id')]
  333.  
  334. r = raster::shift(r, .3*xres(r), .2*yres(r))
  335. cells <- cellFromXY(r, pts)
  336. sel <- aggregate(pts, list(cells), function(i)i[1])
  337. pts = sel[,c("X", "Y",'id')]
  338.  
  339. r = raster::shift(r, .35*xres(r), .25*yres(r))
  340. cells <- cellFromXY(r, pts)
  341. sel <- aggregate(pts, list(cells), function(i)i[1])
  342. pts = sel[,c("X", "Y",'id')]
  343.  
  344. r = raster::shift(r, .2*xres(r), .2*yres(r))
  345. cells <- cellFromXY(r, pts)
  346. sel <- aggregate(pts, list(cells), function(i)i[1])
  347. pts = sel[,c("X", "Y",'id')]
  348.  
  349. r = raster::shift(r, .25*xres(r), .25*yres(r))
  350. cells <- cellFromXY(r, pts)
  351. sel <- aggregate(pts, list(cells), function(i)i[1])
  352. pts = sel[,c("X", "Y",'id')]
  353.  
  354. r = raster::shift(r, .2*xres(r), .2*yres(r))
  355. cells <- cellFromXY(r, pts)
  356. sel <- aggregate(pts, list(cells), function(i)i[1])
  357. pts = sel[,c("X", "Y",'id')]
  358.  
  359. r = raster::shift(r, .25*xres(r), .25*yres(r))
  360. cells <- cellFromXY(r, pts)
  361. sel <- aggregate(pts, list(cells), function(i)i[1])
  362. pts = sel[,c("X", "Y",'id')]
  363.  
  364. r = raster::shift(r, .2*xres(r), .2*yres(r))
  365. cells <- cellFromXY(r, pts)
  366. sel <- aggregate(pts, list(cells), function(i)i[1])
  367. pts = sel[,c("X", "Y",'id')]
  368.  
  369. r = raster::shift(r, .25*xres(r), .25*yres(r))
  370. cells <- cellFromXY(r, pts)
  371. sel <- aggregate(pts, list(cells), function(i)i[1])
  372. pts = sel[,c("X", "Y",'id')]
  373.  
  374. r = raster::shift(r, .2*xres(r), .2*yres(r))
  375. cells <- cellFromXY(r, pts)
  376. sel <- aggregate(pts, list(cells), function(i)i[1])
  377. pts = sel[,c("X", "Y",'id')]
  378.  
  379. r = raster::shift(r, .25*xres(r), .25*yres(r))
  380. cells <- cellFromXY(r, pts)
  381. sel <- aggregate(pts, list(cells), function(i)i[1])
  382. pts = sel[,c("X", "Y",'id')]
  383.  
  384. r = raster::shift(r, .3*xres(r), .9*yres(r))
  385. cells <- cellFromXY(r, pts)
  386. sel <- aggregate(pts, list(cells), function(i)i[1])
  387. pts = sel[,c("X", "Y",'id')]
  388.  
  389. r = raster::shift(r, .35*xres(r), .95*yres(r))
  390. cells <- cellFromXY(r, pts)
  391. sel <- aggregate(pts, list(cells), function(i)i[1])
  392. pts = sel[,c("X", "Y",'id')]
  393.  
  394. r = raster::shift(r, .9*xres(r), .3*yres(r))
  395. cells <- cellFromXY(r, pts)
  396. sel <- aggregate(pts, list(cells), function(i)i[1])
  397. pts = sel[,c("X", "Y",'id')]
  398.  
  399. r = raster::shift(r, .95*xres(r), .35*yres(r))
  400. cells <- cellFromXY(r, pts)
  401. sel <- aggregate(pts, list(cells), function(i)i[1])
  402. pts = sel[,c("X", "Y",'id')]
  403.  
  404. r = raster::shift(r, .3*xres(r), .8*yres(r))
  405. cells <- cellFromXY(r, pts)
  406. sel <- aggregate(pts, list(cells), function(i)i[1])
  407. pts = sel[,c("X", "Y",'id')]
  408.  
  409. r = raster::shift(r, .35*xres(r), .85*yres(r))
  410. cells <- cellFromXY(r, pts)
  411. sel <- aggregate(pts, list(cells), function(i)i[1])
  412. pts = sel[,c("X", "Y",'id')]
  413.  
  414. r = raster::shift(r, .8*xres(r), .3*yres(r))
  415. cells <- cellFromXY(r, pts)
  416. sel <- aggregate(pts, list(cells), function(i)i[1])
  417. pts = sel[,c("X", "Y",'id')]
  418.  
  419. r = raster::shift(r, .85*xres(r), .35*yres(r))
  420. cells <- cellFromXY(r, pts)
  421. sel <- aggregate(pts, list(cells), function(i)i[1])
  422. pts = sel[,c("X", "Y",'id')]
  423.  
  424. r = raster::shift(r, .3*xres(r), .7*yres(r))
  425. cells <- cellFromXY(r, pts)
  426. sel <- aggregate(pts, list(cells), function(i)i[1])
  427. pts = sel[,c("X", "Y",'id')]
  428.  
  429. r = raster::shift(r, .35*xres(r), .75*yres(r))
  430. cells <- cellFromXY(r, pts)
  431. sel <- aggregate(pts, list(cells), function(i)i[1])
  432. pts = sel[,c("X", "Y",'id')]
  433.  
  434. r = raster::shift(r, .7*xres(r), .3*yres(r))
  435. cells <- cellFromXY(r, pts)
  436. sel <- aggregate(pts, list(cells), function(i)i[1])
  437. pts = sel[,c("X", "Y",'id')]
  438.  
  439. r = raster::shift(r, .75*xres(r), .35*yres(r))
  440. cells <- cellFromXY(r, pts)
  441. sel <- aggregate(pts, list(cells), function(i)i[1])
  442. pts = sel[,c("X", "Y",'id')]
  443.  
  444. r = raster::shift(r, .3*xres(r), .6*yres(r))
  445. cells <- cellFromXY(r, pts)
  446. sel <- aggregate(pts, list(cells), function(i)i[1])
  447. pts = sel[,c("X", "Y",'id')]
  448.  
  449. r = raster::shift(r, .35*xres(r), .65*yres(r))
  450. cells <- cellFromXY(r, pts)
  451. sel <- aggregate(pts, list(cells), function(i)i[1])
  452. pts = sel[,c("X", "Y",'id')]
  453.  
  454. r = raster::shift(r, .6*xres(r), .3*yres(r))
  455. cells <- cellFromXY(r, pts)
  456. sel <- aggregate(pts, list(cells), function(i)i[1])
  457. pts = sel[,c("X", "Y",'id')]
  458.  
  459. r = raster::shift(r, .65*xres(r), .35*yres(r))
  460. cells <- cellFromXY(r, pts)
  461. sel <- aggregate(pts, list(cells), function(i)i[1])
  462. pts = sel[,c("X", "Y",'id')]
  463.  
  464. r = raster::shift(r, .3*xres(r), .5*yres(r))
  465. cells <- cellFromXY(r, pts)
  466. sel <- aggregate(pts, list(cells), function(i)i[1])
  467. pts = sel[,c("X", "Y",'id')]
  468.  
  469. r = raster::shift(r, .35*xres(r), .55*yres(r))
  470. cells <- cellFromXY(r, pts)
  471. sel <- aggregate(pts, list(cells), function(i)i[1])
  472. pts = sel[,c("X", "Y",'id')]
  473.  
  474. r = raster::shift(r, .5*xres(r), .3*yres(r))
  475. cells <- cellFromXY(r, pts)
  476. sel <- aggregate(pts, list(cells), function(i)i[1])
  477. pts = sel[,c("X", "Y",'id')]
  478.  
  479. r = raster::shift(r, .55*xres(r), .35*yres(r))
  480. cells <- cellFromXY(r, pts)
  481. sel <- aggregate(pts, list(cells), function(i)i[1])
  482. pts = sel[,c("X", "Y",'id')]
  483.  
  484. r = raster::shift(r, .3*xres(r), .4*yres(r))
  485. cells <- cellFromXY(r, pts)
  486. sel <- aggregate(pts, list(cells), function(i)i[1])
  487. pts = sel[,c("X", "Y",'id')]
  488.  
  489. r = raster::shift(r, .35*xres(r), .45*yres(r))
  490. cells <- cellFromXY(r, pts)
  491. sel <- aggregate(pts, list(cells), function(i)i[1])
  492. pts = sel[,c("X", "Y",'id')]
  493.  
  494. r = raster::shift(r, .4*xres(r), .3*yres(r))
  495. cells <- cellFromXY(r, pts)
  496. sel <- aggregate(pts, list(cells), function(i)i[1])
  497. pts = sel[,c("X", "Y",'id')]
  498.  
  499. r = raster::shift(r, .45*xres(r), .35*yres(r))
  500. cells <- cellFromXY(r, pts)
  501. sel <- aggregate(pts, list(cells), function(i)i[1])
  502. pts = sel[,c("X", "Y",'id')]
  503.  
  504. r = raster::shift(r, .3*xres(r), .3*yres(r))
  505. cells <- cellFromXY(r, pts)
  506. sel <- aggregate(pts, list(cells), function(i)i[1])
  507. pts = sel[,c("X", "Y",'id')]
  508.  
  509. r = raster::shift(r, .35*xres(r), .35*yres(r))
  510. cells <- cellFromXY(r, pts)
  511. sel <- aggregate(pts, list(cells), function(i)i[1])
  512. pts = sel[,c("X", "Y",'id')]
  513.  
  514. r = raster::shift(r, .3*xres(r), .3*yres(r))
  515. cells <- cellFromXY(r, pts)
  516. sel <- aggregate(pts, list(cells), function(i)i[1])
  517. pts = sel[,c("X", "Y",'id')]
  518.  
  519. r = raster::shift(r, .35*xres(r), .35*yres(r))
  520. cells <- cellFromXY(r, pts)
  521. sel <- aggregate(pts, list(cells), function(i)i[1])
  522. pts = sel[,c("X", "Y",'id')]
  523.  
  524. r = raster::shift(r, .3*xres(r), .2*yres(r))
  525. cells <- cellFromXY(r, pts)
  526. sel <- aggregate(pts, list(cells), function(i)i[1])
  527. pts = sel[,c("X", "Y",'id')]
  528.  
  529. r = raster::shift(r, .35*xres(r), .25*yres(r))
  530. cells <- cellFromXY(r, pts)
  531. sel <- aggregate(pts, list(cells), function(i)i[1])
  532. pts = sel[,c("X", "Y",'id')]
  533.  
  534. r = raster::shift(r, .2*xres(r), .3*yres(r))
  535. cells <- cellFromXY(r, pts)
  536. sel <- aggregate(pts, list(cells), function(i)i[1])
  537. pts = sel[,c("X", "Y",'id')]
  538.  
  539. r = raster::shift(r, .25*xres(r), .35*yres(r))
  540. cells <- cellFromXY(r, pts)
  541. sel <- aggregate(pts, list(cells), function(i)i[1])
  542. pts = sel[,c("X", "Y",'id')]
  543.  
  544. r = raster::shift(r, .3*xres(r), .3*yres(r))
  545. cells <- cellFromXY(r, pts)
  546. sel <- aggregate(pts, list(cells), function(i)i[1])
  547. pts = sel[,c("X", "Y",'id')]
  548.  
  549. r = raster::shift(r, .35*xres(r), .35*yres(r))
  550. cells <- cellFromXY(r, pts)
  551. sel <- aggregate(pts, list(cells), function(i)i[1])
  552. pts = sel[,c("X", "Y",'id')]
  553.  
  554. r = raster::shift(r, .3*xres(r), .3*yres(r))
  555. cells <- cellFromXY(r, pts)
  556. sel <- aggregate(pts, list(cells), function(i)i[1])
  557. pts = sel[,c("X", "Y",'id')]
  558.  
  559. r = raster::shift(r, .35*xres(r), .35*yres(r))
  560. cells <- cellFromXY(r, pts)
  561. sel <- aggregate(pts, list(cells), function(i)i[1])
  562. pts = sel[,c("X", "Y",'id')]
  563.  
  564. r = raster::shift(r, .4*xres(r), .9*yres(r))
  565. cells <- cellFromXY(r, pts)
  566. sel <- aggregate(pts, list(cells), function(i)i[1])
  567. pts = sel[,c("X", "Y",'id')]
  568.  
  569. r = raster::shift(r, .45*xres(r), .95*yres(r))
  570. cells <- cellFromXY(r, pts)
  571. sel <- aggregate(pts, list(cells), function(i)i[1])
  572. pts = sel[,c("X", "Y",'id')]
  573.  
  574. r = raster::shift(r, .9*xres(r), .4*yres(r))
  575. cells <- cellFromXY(r, pts)
  576. sel <- aggregate(pts, list(cells), function(i)i[1])
  577. pts = sel[,c("X", "Y",'id')]
  578.  
  579. r = raster::shift(r, .95*xres(r), .45*yres(r))
  580. cells <- cellFromXY(r, pts)
  581. sel <- aggregate(pts, list(cells), function(i)i[1])
  582. pts = sel[,c("X", "Y",'id')]
  583.  
  584. r = raster::shift(r, .4*xres(r), .8*yres(r))
  585. cells <- cellFromXY(r, pts)
  586. sel <- aggregate(pts, list(cells), function(i)i[1])
  587. pts = sel[,c("X", "Y",'id')]
  588.  
  589. r = raster::shift(r, .45*xres(r), .85*yres(r))
  590. cells <- cellFromXY(r, pts)
  591. sel <- aggregate(pts, list(cells), function(i)i[1])
  592. pts = sel[,c("X", "Y",'id')]
  593.  
  594. r = raster::shift(r, .8*xres(r), .4*yres(r))
  595. cells <- cellFromXY(r, pts)
  596. sel <- aggregate(pts, list(cells), function(i)i[1])
  597. pts = sel[,c("X", "Y",'id')]
  598.  
  599. r = raster::shift(r, .85*xres(r), .45*yres(r))
  600. cells <- cellFromXY(r, pts)
  601. sel <- aggregate(pts, list(cells), function(i)i[1])
  602. pts = sel[,c("X", "Y",'id')]
  603.  
  604. r = raster::shift(r, .4*xres(r), .7*yres(r))
  605. cells <- cellFromXY(r, pts)
  606. sel <- aggregate(pts, list(cells), function(i)i[1])
  607. pts = sel[,c("X", "Y",'id')]
  608.  
  609. r = raster::shift(r, .45*xres(r), .75*yres(r))
  610. cells <- cellFromXY(r, pts)
  611. sel <- aggregate(pts, list(cells), function(i)i[1])
  612. pts = sel[,c("X", "Y",'id')]
  613.  
  614. r = raster::shift(r, .7*xres(r), .4*yres(r))
  615. cells <- cellFromXY(r, pts)
  616. sel <- aggregate(pts, list(cells), function(i)i[1])
  617. pts = sel[,c("X", "Y",'id')]
  618.  
  619. r = raster::shift(r, .75*xres(r), .45*yres(r))
  620. cells <- cellFromXY(r, pts)
  621. sel <- aggregate(pts, list(cells), function(i)i[1])
  622. pts = sel[,c("X", "Y",'id')]
  623.  
  624. r = raster::shift(r, .4*xres(r), .6*yres(r))
  625. cells <- cellFromXY(r, pts)
  626. sel <- aggregate(pts, list(cells), function(i)i[1])
  627. pts = sel[,c("X", "Y",'id')]
  628.  
  629. r = raster::shift(r, .45*xres(r), .65*yres(r))
  630. cells <- cellFromXY(r, pts)
  631. sel <- aggregate(pts, list(cells), function(i)i[1])
  632. pts = sel[,c("X", "Y",'id')]
  633.  
  634. r = raster::shift(r, .6*xres(r), .4*yres(r))
  635. cells <- cellFromXY(r, pts)
  636. sel <- aggregate(pts, list(cells), function(i)i[1])
  637. pts = sel[,c("X", "Y",'id')]
  638.  
  639. r = raster::shift(r, .65*xres(r), .45*yres(r))
  640. cells <- cellFromXY(r, pts)
  641. sel <- aggregate(pts, list(cells), function(i)i[1])
  642. pts = sel[,c("X", "Y",'id')]
  643.  
  644. r = raster::shift(r, .4*xres(r), .5*yres(r))
  645. cells <- cellFromXY(r, pts)
  646. sel <- aggregate(pts, list(cells), function(i)i[1])
  647. pts = sel[,c("X", "Y",'id')]
  648.  
  649. r = raster::shift(r, .45*xres(r), .55*yres(r))
  650. cells <- cellFromXY(r, pts)
  651. sel <- aggregate(pts, list(cells), function(i)i[1])
  652. pts = sel[,c("X", "Y",'id')]
  653.  
  654. r = raster::shift(r, .5*xres(r), .4*yres(r))
  655. cells <- cellFromXY(r, pts)
  656. sel <- aggregate(pts, list(cells), function(i)i[1])
  657. pts = sel[,c("X", "Y",'id')]
  658.  
  659. r = raster::shift(r, .55*xres(r), .45*yres(r))
  660. cells <- cellFromXY(r, pts)
  661. sel <- aggregate(pts, list(cells), function(i)i[1])
  662. pts = sel[,c("X", "Y",'id')]
  663.  
  664. r = raster::shift(r, .4*xres(r), .4*yres(r))
  665. cells <- cellFromXY(r, pts)
  666. sel <- aggregate(pts, list(cells), function(i)i[1])
  667. pts = sel[,c("X", "Y",'id')]
  668.  
  669. r = raster::shift(r, .45*xres(r), .45*yres(r))
  670. cells <- cellFromXY(r, pts)
  671. sel <- aggregate(pts, list(cells), function(i)i[1])
  672. pts = sel[,c("X", "Y",'id')]
  673.  
  674. r = raster::shift(r, .4*xres(r), .4*yres(r))
  675. cells <- cellFromXY(r, pts)
  676. sel <- aggregate(pts, list(cells), function(i)i[1])
  677. pts = sel[,c("X", "Y",'id')]
  678.  
  679. r = raster::shift(r, .45*xres(r), .45*yres(r))
  680. cells <- cellFromXY(r, pts)
  681. sel <- aggregate(pts, list(cells), function(i)i[1])
  682. pts = sel[,c("X", "Y",'id')]
  683.  
  684. r = raster::shift(r, .4*xres(r), .3*yres(r))
  685. cells <- cellFromXY(r, pts)
  686. sel <- aggregate(pts, list(cells), function(i)i[1])
  687. pts = sel[,c("X", "Y",'id')]
  688.  
  689. r = raster::shift(r, .45*xres(r), .35*yres(r))
  690. cells <- cellFromXY(r, pts)
  691. sel <- aggregate(pts, list(cells), function(i)i[1])
  692. pts = sel[,c("X", "Y",'id')]
  693.  
  694. r = raster::shift(r, .3*xres(r), .4*yres(r))
  695. cells <- cellFromXY(r, pts)
  696. sel <- aggregate(pts, list(cells), function(i)i[1])
  697. pts = sel[,c("X", "Y",'id')]
  698.  
  699. r = raster::shift(r, .35*xres(r), .45*yres(r))
  700. cells <- cellFromXY(r, pts)
  701. sel <- aggregate(pts, list(cells), function(i)i[1])
  702. pts = sel[,c("X", "Y",'id')]
  703.  
  704. r = raster::shift(r, .4*xres(r), .2*yres(r))
  705. cells <- cellFromXY(r, pts)
  706. sel <- aggregate(pts, list(cells), function(i)i[1])
  707. pts = sel[,c("X", "Y",'id')]
  708.  
  709. r = raster::shift(r, .45*xres(r), .25*yres(r))
  710. cells <- cellFromXY(r, pts)
  711. sel <- aggregate(pts, list(cells), function(i)i[1])
  712. pts = sel[,c("X", "Y",'id')]
  713.  
  714. r = raster::shift(r, .2*xres(r), .4*yres(r))
  715. cells <- cellFromXY(r, pts)
  716. sel <- aggregate(pts, list(cells), function(i)i[1])
  717. pts = sel[,c("X", "Y",'id')]
  718.  
  719. r = raster::shift(r, .25*xres(r), .45*yres(r))
  720. cells <- cellFromXY(r, pts)
  721. sel <- aggregate(pts, list(cells), function(i)i[1])
  722. pts = sel[,c("X", "Y",'id')]
  723.  
  724. r = raster::shift(r, .4*xres(r), .4*yres(r))
  725. cells <- cellFromXY(r, pts)
  726. sel <- aggregate(pts, list(cells), function(i)i[1])
  727. pts = sel[,c("X", "Y",'id')]
  728.  
  729. r = raster::shift(r, .45*xres(r), .45*yres(r))
  730. cells <- cellFromXY(r, pts)
  731. sel <- aggregate(pts, list(cells), function(i)i[1])
  732. pts = sel[,c("X", "Y",'id')]
  733.  
  734. r = raster::shift(r, .4*xres(r), .4*yres(r))
  735. cells <- cellFromXY(r, pts)
  736. sel <- aggregate(pts, list(cells), function(i)i[1])
  737. pts = sel[,c("X", "Y",'id')]
  738.  
  739. r = raster::shift(r, .45*xres(r), .45*yres(r))
  740. cells <- cellFromXY(r, pts)
  741. sel <- aggregate(pts, list(cells), function(i)i[1])
  742. pts = sel[,c("X", "Y",'id')]
  743.  
  744. r = raster::shift(r, .5*xres(r), .9*yres(r))
  745. cells <- cellFromXY(r, pts)
  746. sel <- aggregate(pts, list(cells), function(i)i[1])
  747. pts = sel[,c("X", "Y",'id')]
  748.  
  749. r = raster::shift(r, .55*xres(r), .95*yres(r))
  750. cells <- cellFromXY(r, pts)
  751. sel <- aggregate(pts, list(cells), function(i)i[1])
  752. pts = sel[,c("X", "Y",'id')]
  753.  
  754. r = raster::shift(r, .9*xres(r), .5*yres(r))
  755. cells <- cellFromXY(r, pts)
  756. sel <- aggregate(pts, list(cells), function(i)i[1])
  757. pts = sel[,c("X", "Y",'id')]
  758.  
  759. r = raster::shift(r, .95*xres(r), .55*yres(r))
  760. cells <- cellFromXY(r, pts)
  761. sel <- aggregate(pts, list(cells), function(i)i[1])
  762. pts = sel[,c("X", "Y",'id')]
  763.  
  764. r = raster::shift(r, .5*xres(r), .8*yres(r))
  765. cells <- cellFromXY(r, pts)
  766. sel <- aggregate(pts, list(cells), function(i)i[1])
  767. pts = sel[,c("X", "Y",'id')]
  768.  
  769. r = raster::shift(r, .55*xres(r), .85*yres(r))
  770. cells <- cellFromXY(r, pts)
  771. sel <- aggregate(pts, list(cells), function(i)i[1])
  772. pts = sel[,c("X", "Y",'id')]
  773.  
  774. r = raster::shift(r, .8*xres(r), .5*yres(r))
  775. cells <- cellFromXY(r, pts)
  776. sel <- aggregate(pts, list(cells), function(i)i[1])
  777. pts = sel[,c("X", "Y",'id')]
  778.  
  779. r = raster::shift(r, .85*xres(r), .55*yres(r))
  780. cells <- cellFromXY(r, pts)
  781. sel <- aggregate(pts, list(cells), function(i)i[1])
  782. pts = sel[,c("X", "Y",'id')]
  783.  
  784. r = raster::shift(r, .5*xres(r), .7*yres(r))
  785. cells <- cellFromXY(r, pts)
  786. sel <- aggregate(pts, list(cells), function(i)i[1])
  787. pts = sel[,c("X", "Y",'id')]
  788.  
  789. r = raster::shift(r, .55*xres(r), .75*yres(r))
  790. cells <- cellFromXY(r, pts)
  791. sel <- aggregate(pts, list(cells), function(i)i[1])
  792. pts = sel[,c("X", "Y",'id')]
  793.  
  794. r = raster::shift(r, .7*xres(r), .5*yres(r))
  795. cells <- cellFromXY(r, pts)
  796. sel <- aggregate(pts, list(cells), function(i)i[1])
  797. pts = sel[,c("X", "Y",'id')]
  798.  
  799. r = raster::shift(r, .75*xres(r), .55*yres(r))
  800. cells <- cellFromXY(r, pts)
  801. sel <- aggregate(pts, list(cells), function(i)i[1])
  802. pts = sel[,c("X", "Y",'id')]
  803.  
  804. r = raster::shift(r, .5*xres(r), .6*yres(r))
  805. cells <- cellFromXY(r, pts)
  806. sel <- aggregate(pts, list(cells), function(i)i[1])
  807. pts = sel[,c("X", "Y",'id')]
  808.  
  809. r = raster::shift(r, .55*xres(r), .65*yres(r))
  810. cells <- cellFromXY(r, pts)
  811. sel <- aggregate(pts, list(cells), function(i)i[1])
  812. pts = sel[,c("X", "Y",'id')]
  813.  
  814. r = raster::shift(r, .6*xres(r), .5*yres(r))
  815. cells <- cellFromXY(r, pts)
  816. sel <- aggregate(pts, list(cells), function(i)i[1])
  817. pts = sel[,c("X", "Y",'id')]
  818.  
  819. r = raster::shift(r, .65*xres(r), .55*yres(r))
  820. cells <- cellFromXY(r, pts)
  821. sel <- aggregate(pts, list(cells), function(i)i[1])
  822. pts = sel[,c("X", "Y",'id')]
  823.  
  824. r = raster::shift(r, .5*xres(r), .5*yres(r))
  825. cells <- cellFromXY(r, pts)
  826. sel <- aggregate(pts, list(cells), function(i)i[1])
  827. pts = sel[,c("X", "Y",'id')]
  828.  
  829. r = raster::shift(r, .55*xres(r), .55*yres(r))
  830. cells <- cellFromXY(r, pts)
  831. sel <- aggregate(pts, list(cells), function(i)i[1])
  832. pts = sel[,c("X", "Y",'id')]
  833.  
  834. r = raster::shift(r, .5*xres(r), .5*yres(r))
  835. cells <- cellFromXY(r, pts)
  836. sel <- aggregate(pts, list(cells), function(i)i[1])
  837. pts = sel[,c("X", "Y",'id')]
  838.  
  839. r = raster::shift(r, .55*xres(r), .55*yres(r))
  840. cells <- cellFromXY(r, pts)
  841. sel <- aggregate(pts, list(cells), function(i)i[1])
  842. pts = sel[,c("X", "Y",'id')]
  843.  
  844. r = raster::shift(r, .5*xres(r), .4*yres(r))
  845. cells <- cellFromXY(r, pts)
  846. sel <- aggregate(pts, list(cells), function(i)i[1])
  847. pts = sel[,c("X", "Y",'id')]
  848.  
  849. r = raster::shift(r, .55*xres(r), .45*yres(r))
  850. cells <- cellFromXY(r, pts)
  851. sel <- aggregate(pts, list(cells), function(i)i[1])
  852. pts = sel[,c("X", "Y",'id')]
  853.  
  854. r = raster::shift(r, .4*xres(r), .5*yres(r))
  855. cells <- cellFromXY(r, pts)
  856. sel <- aggregate(pts, list(cells), function(i)i[1])
  857. pts = sel[,c("X", "Y",'id')]
  858.  
  859. r = raster::shift(r, .45*xres(r), .55*yres(r))
  860. cells <- cellFromXY(r, pts)
  861. sel <- aggregate(pts, list(cells), function(i)i[1])
  862. pts = sel[,c("X", "Y",'id')]
  863.  
  864. r = raster::shift(r, .5*xres(r), .3*yres(r))
  865. cells <- cellFromXY(r, pts)
  866. sel <- aggregate(pts, list(cells), function(i)i[1])
  867. pts = sel[,c("X", "Y",'id')]
  868.  
  869. r = raster::shift(r, .55*xres(r), .35*yres(r))
  870. cells <- cellFromXY(r, pts)
  871. sel <- aggregate(pts, list(cells), function(i)i[1])
  872. pts = sel[,c("X", "Y",'id')]
  873.  
  874. r = raster::shift(r, .3*xres(r), .5*yres(r))
  875. cells <- cellFromXY(r, pts)
  876. sel <- aggregate(pts, list(cells), function(i)i[1])
  877. pts = sel[,c("X", "Y",'id')]
  878.  
  879. r = raster::shift(r, .35*xres(r), .55*yres(r))
  880. cells <- cellFromXY(r, pts)
  881. sel <- aggregate(pts, list(cells), function(i)i[1])
  882. pts = sel[,c("X", "Y",'id')]
  883.  
  884. r = raster::shift(r, .5*xres(r), .2*yres(r))
  885. cells <- cellFromXY(r, pts)
  886. sel <- aggregate(pts, list(cells), function(i)i[1])
  887. pts = sel[,c("X", "Y",'id')]
  888.  
  889. r = raster::shift(r, .55*xres(r), .25*yres(r))
  890. cells <- cellFromXY(r, pts)
  891. sel <- aggregate(pts, list(cells), function(i)i[1])
  892. pts = sel[,c("X", "Y",'id')]
  893.  
  894. r = raster::shift(r, .2*xres(r), .5*yres(r))
  895. cells <- cellFromXY(r, pts)
  896. sel <- aggregate(pts, list(cells), function(i)i[1])
  897. pts = sel[,c("X", "Y",'id')]
  898.  
  899. r = raster::shift(r, .25*xres(r), .55*yres(r))
  900. cells <- cellFromXY(r, pts)
  901. sel <- aggregate(pts, list(cells), function(i)i[1])
  902. pts = sel[,c("X", "Y",'id')]
  903.  
  904. r = raster::shift(r, .5*xres(r), .5*yres(r))
  905. cells <- cellFromXY(r, pts)
  906. sel <- aggregate(pts, list(cells), function(i)i[1])
  907. pts = sel[,c("X", "Y",'id')]
  908.  
  909. r = raster::shift(r, .55*xres(r), .55*yres(r))
  910. cells <- cellFromXY(r, pts)
  911. sel <- aggregate(pts, list(cells), function(i)i[1])
  912. pts = sel[,c("X", "Y",'id')]
  913.  
  914. r = raster::shift(r, .5*xres(r), .5*yres(r))
  915. cells <- cellFromXY(r, pts)
  916. sel <- aggregate(pts, list(cells), function(i)i[1])
  917. pts = sel[,c("X", "Y",'id')]
  918.  
  919. r = raster::shift(r, .55*xres(r), .55*yres(r))
  920. cells <- cellFromXY(r, pts)
  921. sel <- aggregate(pts, list(cells), function(i)i[1])
  922. pts = sel[,c("X", "Y",'id')]
  923.  
  924. r = raster::shift(r, .6*xres(r), .9*yres(r))
  925. cells <- cellFromXY(r, pts)
  926. sel <- aggregate(pts, list(cells), function(i)i[1])
  927. pts = sel[,c("X", "Y",'id')]
  928.  
  929. r = raster::shift(r, .65*xres(r), .95*yres(r))
  930. cells <- cellFromXY(r, pts)
  931. sel <- aggregate(pts, list(cells), function(i)i[1])
  932. pts = sel[,c("X", "Y",'id')]
  933.  
  934. r = raster::shift(r, .9*xres(r), .6*yres(r))
  935. cells <- cellFromXY(r, pts)
  936. sel <- aggregate(pts, list(cells), function(i)i[1])
  937. pts = sel[,c("X", "Y",'id')]
  938.  
  939. r = raster::shift(r, .95*xres(r), .65*yres(r))
  940. cells <- cellFromXY(r, pts)
  941. sel <- aggregate(pts, list(cells), function(i)i[1])
  942. pts = sel[,c("X", "Y",'id')]
  943.  
  944. r = raster::shift(r, .6*xres(r), .8*yres(r))
  945. cells <- cellFromXY(r, pts)
  946. sel <- aggregate(pts, list(cells), function(i)i[1])
  947. pts = sel[,c("X", "Y",'id')]
  948.  
  949. r = raster::shift(r, .65*xres(r), .85*yres(r))
  950. cells <- cellFromXY(r, pts)
  951. sel <- aggregate(pts, list(cells), function(i)i[1])
  952. pts = sel[,c("X", "Y",'id')]
  953.  
  954. r = raster::shift(r, .8*xres(r), .6*yres(r))
  955. cells <- cellFromXY(r, pts)
  956. sel <- aggregate(pts, list(cells), function(i)i[1])
  957. pts = sel[,c("X", "Y",'id')]
  958.  
  959. r = raster::shift(r, .85*xres(r), .65*yres(r))
  960. cells <- cellFromXY(r, pts)
  961. sel <- aggregate(pts, list(cells), function(i)i[1])
  962. pts = sel[,c("X", "Y",'id')]
  963.  
  964. r = raster::shift(r, .6*xres(r), .7*yres(r))
  965. cells <- cellFromXY(r, pts)
  966. sel <- aggregate(pts, list(cells), function(i)i[1])
  967. pts = sel[,c("X", "Y",'id')]
  968.  
  969. r = raster::shift(r, .65*xres(r), .75*yres(r))
  970. cells <- cellFromXY(r, pts)
  971. sel <- aggregate(pts, list(cells), function(i)i[1])
  972. pts = sel[,c("X", "Y",'id')]
  973.  
  974. r = raster::shift(r, .7*xres(r), .6*yres(r))
  975. cells <- cellFromXY(r, pts)
  976. sel <- aggregate(pts, list(cells), function(i)i[1])
  977. pts = sel[,c("X", "Y",'id')]
  978.  
  979. r = raster::shift(r, .75*xres(r), .65*yres(r))
  980. cells <- cellFromXY(r, pts)
  981. sel <- aggregate(pts, list(cells), function(i)i[1])
  982. pts = sel[,c("X", "Y",'id')]
  983.  
  984. r = raster::shift(r, .6*xres(r), .6*yres(r))
  985. cells <- cellFromXY(r, pts)
  986. sel <- aggregate(pts, list(cells), function(i)i[1])
  987. pts = sel[,c("X", "Y",'id')]
  988.  
  989. r = raster::shift(r, .65*xres(r), .65*yres(r))
  990. cells <- cellFromXY(r, pts)
  991. sel <- aggregate(pts, list(cells), function(i)i[1])
  992. pts = sel[,c("X", "Y",'id')]
  993.  
  994. r = raster::shift(r, .6*xres(r), .6*yres(r))
  995. cells <- cellFromXY(r, pts)
  996. sel <- aggregate(pts, list(cells), function(i)i[1])
  997. pts = sel[,c("X", "Y",'id')]
  998.  
  999. r = raster::shift(r, .65*xres(r), .65*yres(r))
  1000. cells <- cellFromXY(r, pts)
  1001. sel <- aggregate(pts, list(cells), function(i)i[1])
  1002. pts = sel[,c("X", "Y",'id')]
  1003.  
  1004. r = raster::shift(r, .6*xres(r), .5*yres(r))
  1005. cells <- cellFromXY(r, pts)
  1006. sel <- aggregate(pts, list(cells), function(i)i[1])
  1007. pts = sel[,c("X", "Y",'id')]
  1008.  
  1009. r = raster::shift(r, .65*xres(r), .55*yres(r))
  1010. cells <- cellFromXY(r, pts)
  1011. sel <- aggregate(pts, list(cells), function(i)i[1])
  1012. pts = sel[,c("X", "Y",'id')]
  1013.  
  1014. r = raster::shift(r, .5*xres(r), .6*yres(r))
  1015. cells <- cellFromXY(r, pts)
  1016. sel <- aggregate(pts, list(cells), function(i)i[1])
  1017. pts = sel[,c("X", "Y",'id')]
  1018.  
  1019. r = raster::shift(r, .55*xres(r), .65*yres(r))
  1020. cells <- cellFromXY(r, pts)
  1021. sel <- aggregate(pts, list(cells), function(i)i[1])
  1022. pts = sel[,c("X", "Y",'id')]
  1023.  
  1024. r = raster::shift(r, .6*xres(r), .4*yres(r))
  1025. cells <- cellFromXY(r, pts)
  1026. sel <- aggregate(pts, list(cells), function(i)i[1])
  1027. pts = sel[,c("X", "Y",'id')]
  1028.  
  1029. r = raster::shift(r, .65*xres(r), .45*yres(r))
  1030. cells <- cellFromXY(r, pts)
  1031. sel <- aggregate(pts, list(cells), function(i)i[1])
  1032. pts = sel[,c("X", "Y",'id')]
  1033.  
  1034. r = raster::shift(r, .4*xres(r), .6*yres(r))
  1035. cells <- cellFromXY(r, pts)
  1036. sel <- aggregate(pts, list(cells), function(i)i[1])
  1037. pts = sel[,c("X", "Y",'id')]
  1038.  
  1039. r = raster::shift(r, .45*xres(r), .65*yres(r))
  1040. cells <- cellFromXY(r, pts)
  1041. sel <- aggregate(pts, list(cells), function(i)i[1])
  1042. pts = sel[,c("X", "Y",'id')]
  1043.  
  1044. r = raster::shift(r, .6*xres(r), .3*yres(r))
  1045. cells <- cellFromXY(r, pts)
  1046. sel <- aggregate(pts, list(cells), function(i)i[1])
  1047. pts = sel[,c("X", "Y",'id')]
  1048.  
  1049. r = raster::shift(r, .65*xres(r), .35*yres(r))
  1050. cells <- cellFromXY(r, pts)
  1051. sel <- aggregate(pts, list(cells), function(i)i[1])
  1052. pts = sel[,c("X", "Y",'id')]
  1053.  
  1054. r = raster::shift(r, .3*xres(r), .6*yres(r))
  1055. cells <- cellFromXY(r, pts)
  1056. sel <- aggregate(pts, list(cells), function(i)i[1])
  1057. pts = sel[,c("X", "Y",'id')]
  1058.  
  1059. r = raster::shift(r, .35*xres(r), .65*yres(r))
  1060. cells <- cellFromXY(r, pts)
  1061. sel <- aggregate(pts, list(cells), function(i)i[1])
  1062. pts = sel[,c("X", "Y",'id')]
  1063.  
  1064. r = raster::shift(r, .6*xres(r), .2*yres(r))
  1065. cells <- cellFromXY(r, pts)
  1066. sel <- aggregate(pts, list(cells), function(i)i[1])
  1067. pts = sel[,c("X", "Y",'id')]
  1068.  
  1069. r = raster::shift(r, .65*xres(r), .25*yres(r))
  1070. cells <- cellFromXY(r, pts)
  1071. sel <- aggregate(pts, list(cells), function(i)i[1])
  1072. pts = sel[,c("X", "Y",'id')]
  1073.  
  1074. r = raster::shift(r, .2*xres(r), .6*yres(r))
  1075. cells <- cellFromXY(r, pts)
  1076. sel <- aggregate(pts, list(cells), function(i)i[1])
  1077. pts = sel[,c("X", "Y",'id')]
  1078.  
  1079. r = raster::shift(r, .25*xres(r), .65*yres(r))
  1080. cells <- cellFromXY(r, pts)
  1081. sel <- aggregate(pts, list(cells), function(i)i[1])
  1082. pts = sel[,c("X", "Y",'id')]
  1083.  
  1084. r = raster::shift(r, .6*xres(r), .6*yres(r))
  1085. cells <- cellFromXY(r, pts)
  1086. sel <- aggregate(pts, list(cells), function(i)i[1])
  1087. pts = sel[,c("X", "Y",'id')]
  1088.  
  1089. r = raster::shift(r, .65*xres(r), .65*yres(r))
  1090. cells <- cellFromXY(r, pts)
  1091. sel <- aggregate(pts, list(cells), function(i)i[1])
  1092. pts = sel[,c("X", "Y",'id')]
  1093.  
  1094. r = raster::shift(r, .6*xres(r), .6*yres(r))
  1095. cells <- cellFromXY(r, pts)
  1096. sel <- aggregate(pts, list(cells), function(i)i[1])
  1097. pts = sel[,c("X", "Y",'id')]
  1098.  
  1099. r = raster::shift(r, .65*xres(r), .65*yres(r))
  1100. cells <- cellFromXY(r, pts)
  1101. sel <- aggregate(pts, list(cells), function(i)i[1])
  1102. pts = sel[,c("X", "Y",'id')]
  1103.  
  1104. r = raster::shift(r, .7*xres(r), .9*yres(r))
  1105. cells <- cellFromXY(r, pts)
  1106. sel <- aggregate(pts, list(cells), function(i)i[1])
  1107. pts = sel[,c("X", "Y",'id')]
  1108.  
  1109. r = raster::shift(r, .75*xres(r), .95*yres(r))
  1110. cells <- cellFromXY(r, pts)
  1111. sel <- aggregate(pts, list(cells), function(i)i[1])
  1112. pts = sel[,c("X", "Y",'id')]
  1113.  
  1114. r = raster::shift(r, .9*xres(r), .7*yres(r))
  1115. cells <- cellFromXY(r, pts)
  1116. sel <- aggregate(pts, list(cells), function(i)i[1])
  1117. pts = sel[,c("X", "Y",'id')]
  1118.  
  1119. r = raster::shift(r, .95*xres(r), .75*yres(r))
  1120. cells <- cellFromXY(r, pts)
  1121. sel <- aggregate(pts, list(cells), function(i)i[1])
  1122. pts = sel[,c("X", "Y",'id')]
  1123.  
  1124. r = raster::shift(r, .7*xres(r), .8*yres(r))
  1125. cells <- cellFromXY(r, pts)
  1126. sel <- aggregate(pts, list(cells), function(i)i[1])
  1127. pts = sel[,c("X", "Y",'id')]
  1128.  
  1129. r = raster::shift(r, .75*xres(r), .85*yres(r))
  1130. cells <- cellFromXY(r, pts)
  1131. sel <- aggregate(pts, list(cells), function(i)i[1])
  1132. pts = sel[,c("X", "Y",'id')]
  1133.  
  1134. r = raster::shift(r, .8*xres(r), .7*yres(r))
  1135. cells <- cellFromXY(r, pts)
  1136. sel <- aggregate(pts, list(cells), function(i)i[1])
  1137. pts = sel[,c("X", "Y",'id')]
  1138.  
  1139. r = raster::shift(r, .85*xres(r), .75*yres(r))
  1140. cells <- cellFromXY(r, pts)
  1141. sel <- aggregate(pts, list(cells), function(i)i[1])
  1142. pts = sel[,c("X", "Y",'id')]
  1143.  
  1144. r = raster::shift(r, .7*xres(r), .7*yres(r))
  1145. cells <- cellFromXY(r, pts)
  1146. sel <- aggregate(pts, list(cells), function(i)i[1])
  1147. pts = sel[,c("X", "Y",'id')]
  1148.  
  1149. r = raster::shift(r, .75*xres(r), .75*yres(r))
  1150. cells <- cellFromXY(r, pts)
  1151. sel <- aggregate(pts, list(cells), function(i)i[1])
  1152. pts = sel[,c("X", "Y",'id')]
  1153.  
  1154. r = raster::shift(r, .7*xres(r), .7*yres(r))
  1155. cells <- cellFromXY(r, pts)
  1156. sel <- aggregate(pts, list(cells), function(i)i[1])
  1157. pts = sel[,c("X", "Y",'id')]
  1158.  
  1159. r = raster::shift(r, .75*xres(r), .75*yres(r))
  1160. cells <- cellFromXY(r, pts)
  1161. sel <- aggregate(pts, list(cells), function(i)i[1])
  1162. pts = sel[,c("X", "Y",'id')]
  1163.  
  1164. r = raster::shift(r, .7*xres(r), .6*yres(r))
  1165. cells <- cellFromXY(r, pts)
  1166. sel <- aggregate(pts, list(cells), function(i)i[1])
  1167. pts = sel[,c("X", "Y",'id')]
  1168.  
  1169. r = raster::shift(r, .75*xres(r), .65*yres(r))
  1170. cells <- cellFromXY(r, pts)
  1171. sel <- aggregate(pts, list(cells), function(i)i[1])
  1172. pts = sel[,c("X", "Y",'id')]
  1173.  
  1174. r = raster::shift(r, .6*xres(r), .7*yres(r))
  1175. cells <- cellFromXY(r, pts)
  1176. sel <- aggregate(pts, list(cells), function(i)i[1])
  1177. pts = sel[,c("X", "Y",'id')]
  1178.  
  1179. r = raster::shift(r, .65*xres(r), .75*yres(r))
  1180. cells <- cellFromXY(r, pts)
  1181. sel <- aggregate(pts, list(cells), function(i)i[1])
  1182. pts = sel[,c("X", "Y",'id')]
  1183.  
  1184. r = raster::shift(r, .7*xres(r), .5*yres(r))
  1185. cells <- cellFromXY(r, pts)
  1186. sel <- aggregate(pts, list(cells), function(i)i[1])
  1187. pts = sel[,c("X", "Y",'id')]
  1188.  
  1189. r = raster::shift(r, .75*xres(r), .55*yres(r))
  1190. cells <- cellFromXY(r, pts)
  1191. sel <- aggregate(pts, list(cells), function(i)i[1])
  1192. pts = sel[,c("X", "Y",'id')]
  1193.  
  1194. r = raster::shift(r, .5*xres(r), .7*yres(r))
  1195. cells <- cellFromXY(r, pts)
  1196. sel <- aggregate(pts, list(cells), function(i)i[1])
  1197. pts = sel[,c("X", "Y",'id')]
  1198.  
  1199. r = raster::shift(r, .55*xres(r), .75*yres(r))
  1200. cells <- cellFromXY(r, pts)
  1201. sel <- aggregate(pts, list(cells), function(i)i[1])
  1202. pts = sel[,c("X", "Y",'id')]
  1203.  
  1204. r = raster::shift(r, .7*xres(r), .4*yres(r))
  1205. cells <- cellFromXY(r, pts)
  1206. sel <- aggregate(pts, list(cells), function(i)i[1])
  1207. pts = sel[,c("X", "Y",'id')]
  1208.  
  1209. r = raster::shift(r, .75*xres(r), .45*yres(r))
  1210. cells <- cellFromXY(r, pts)
  1211. sel <- aggregate(pts, list(cells), function(i)i[1])
  1212. pts = sel[,c("X", "Y",'id')]
  1213.  
  1214. r = raster::shift(r, .4*xres(r), .7*yres(r))
  1215. cells <- cellFromXY(r, pts)
  1216. sel <- aggregate(pts, list(cells), function(i)i[1])
  1217. pts = sel[,c("X", "Y",'id')]
  1218.  
  1219. r = raster::shift(r, .45*xres(r), .75*yres(r))
  1220. cells <- cellFromXY(r, pts)
  1221. sel <- aggregate(pts, list(cells), function(i)i[1])
  1222. pts = sel[,c("X", "Y",'id')]
  1223.  
  1224. r = raster::shift(r, .7*xres(r), .3*yres(r))
  1225. cells <- cellFromXY(r, pts)
  1226. sel <- aggregate(pts, list(cells), function(i)i[1])
  1227. pts = sel[,c("X", "Y",'id')]
  1228.  
  1229. r = raster::shift(r, .75*xres(r), .35*yres(r))
  1230. cells <- cellFromXY(r, pts)
  1231. sel <- aggregate(pts, list(cells), function(i)i[1])
  1232. pts = sel[,c("X", "Y",'id')]
  1233.  
  1234. r = raster::shift(r, .3*xres(r), .7*yres(r))
  1235. cells <- cellFromXY(r, pts)
  1236. sel <- aggregate(pts, list(cells), function(i)i[1])
  1237. pts = sel[,c("X", "Y",'id')]
  1238.  
  1239. r = raster::shift(r, .35*xres(r), .75*yres(r))
  1240. cells <- cellFromXY(r, pts)
  1241. sel <- aggregate(pts, list(cells), function(i)i[1])
  1242. pts = sel[,c("X", "Y",'id')]
  1243.  
  1244. r = raster::shift(r, .7*xres(r), .2*yres(r))
  1245. cells <- cellFromXY(r, pts)
  1246. sel <- aggregate(pts, list(cells), function(i)i[1])
  1247. pts = sel[,c("X", "Y",'id')]
  1248.  
  1249. r = raster::shift(r, .75*xres(r), .25*yres(r))
  1250. cells <- cellFromXY(r, pts)
  1251. sel <- aggregate(pts, list(cells), function(i)i[1])
  1252. pts = sel[,c("X", "Y",'id')]
  1253.  
  1254. r = raster::shift(r, .2*xres(r), .7*yres(r))
  1255. cells <- cellFromXY(r, pts)
  1256. sel <- aggregate(pts, list(cells), function(i)i[1])
  1257. pts = sel[,c("X", "Y",'id')]
  1258.  
  1259. r = raster::shift(r, .25*xres(r), .75*yres(r))
  1260. cells <- cellFromXY(r, pts)
  1261. sel <- aggregate(pts, list(cells), function(i)i[1])
  1262. pts = sel[,c("X", "Y",'id')]
  1263.  
  1264. r = raster::shift(r, .7*xres(r), .7*yres(r))
  1265. cells <- cellFromXY(r, pts)
  1266. sel <- aggregate(pts, list(cells), function(i)i[1])
  1267. pts = sel[,c("X", "Y",'id')]
  1268.  
  1269. r = raster::shift(r, .75*xres(r), .75*yres(r))
  1270. cells <- cellFromXY(r, pts)
  1271. sel <- aggregate(pts, list(cells), function(i)i[1])
  1272. pts = sel[,c("X", "Y",'id')]
  1273.  
  1274. r = raster::shift(r, .7*xres(r), .7*yres(r))
  1275. cells <- cellFromXY(r, pts)
  1276. sel <- aggregate(pts, list(cells), function(i)i[1])
  1277. pts = sel[,c("X", "Y",'id')]
  1278.  
  1279. r = raster::shift(r, .75*xres(r), .75*yres(r))
  1280. cells <- cellFromXY(r, pts)
  1281. sel <- aggregate(pts, list(cells), function(i)i[1])
  1282. pts = sel[,c("X", "Y",'id')]
  1283.  
  1284. r = raster::shift(r, .8*xres(r), .9*yres(r))
  1285. cells <- cellFromXY(r, pts)
  1286. sel <- aggregate(pts, list(cells), function(i)i[1])
  1287. pts = sel[,c("X", "Y",'id')]
  1288.  
  1289. r = raster::shift(r, .85*xres(r), .95*yres(r))
  1290. cells <- cellFromXY(r, pts)
  1291. sel <- aggregate(pts, list(cells), function(i)i[1])
  1292. pts = sel[,c("X", "Y",'id')]
  1293.  
  1294. r = raster::shift(r, .9*xres(r), .8*yres(r))
  1295. cells <- cellFromXY(r, pts)
  1296. sel <- aggregate(pts, list(cells), function(i)i[1])
  1297. pts = sel[,c("X", "Y",'id')]
  1298.  
  1299. r = raster::shift(r, .95*xres(r), .85*yres(r))
  1300. cells <- cellFromXY(r, pts)
  1301. sel <- aggregate(pts, list(cells), function(i)i[1])
  1302. pts = sel[,c("X", "Y",'id')]
  1303.  
  1304. r = raster::shift(r, .8*xres(r), .8*yres(r))
  1305. cells <- cellFromXY(r, pts)
  1306. sel <- aggregate(pts, list(cells), function(i)i[1])
  1307. pts = sel[,c("X", "Y",'id')]
  1308.  
  1309. r = raster::shift(r, .85*xres(r), .85*yres(r))
  1310. cells <- cellFromXY(r, pts)
  1311. sel <- aggregate(pts, list(cells), function(i)i[1])
  1312. pts = sel[,c("X", "Y",'id')]
  1313.  
  1314. r = raster::shift(r, .8*xres(r), .8*yres(r))
  1315. cells <- cellFromXY(r, pts)
  1316. sel <- aggregate(pts, list(cells), function(i)i[1])
  1317. pts = sel[,c("X", "Y",'id')]
  1318.  
  1319. r = raster::shift(r, .85*xres(r), .85*yres(r))
  1320. cells <- cellFromXY(r, pts)
  1321. sel <- aggregate(pts, list(cells), function(i)i[1])
  1322. pts = sel[,c("X", "Y",'id')]
  1323.  
  1324. r = raster::shift(r, .8*xres(r), .7*yres(r))
  1325. cells <- cellFromXY(r, pts)
  1326. sel <- aggregate(pts, list(cells), function(i)i[1])
  1327. pts = sel[,c("X", "Y",'id')]
  1328.  
  1329. r = raster::shift(r, .85*xres(r), .75*yres(r))
  1330. cells <- cellFromXY(r, pts)
  1331. sel <- aggregate(pts, list(cells), function(i)i[1])
  1332. pts = sel[,c("X", "Y",'id')]
  1333.  
  1334. r = raster::shift(r, .7*xres(r), .8*yres(r))
  1335. cells <- cellFromXY(r, pts)
  1336. sel <- aggregate(pts, list(cells), function(i)i[1])
  1337. pts = sel[,c("X", "Y",'id')]
  1338.  
  1339. r = raster::shift(r, .75*xres(r), .85*yres(r))
  1340. cells <- cellFromXY(r, pts)
  1341. sel <- aggregate(pts, list(cells), function(i)i[1])
  1342. pts = sel[,c("X", "Y",'id')]
  1343.  
  1344. r = raster::shift(r, .8*xres(r), .6*yres(r))
  1345. cells <- cellFromXY(r, pts)
  1346. sel <- aggregate(pts, list(cells), function(i)i[1])
  1347. pts = sel[,c("X", "Y",'id')]
  1348.  
  1349. r = raster::shift(r, .85*xres(r), .65*yres(r))
  1350. cells <- cellFromXY(r, pts)
  1351. sel <- aggregate(pts, list(cells), function(i)i[1])
  1352. pts = sel[,c("X", "Y",'id')]
  1353.  
  1354. r = raster::shift(r, .6*xres(r), .8*yres(r))
  1355. cells <- cellFromXY(r, pts)
  1356. sel <- aggregate(pts, list(cells), function(i)i[1])
  1357. pts = sel[,c("X", "Y",'id')]
  1358.  
  1359. r = raster::shift(r, .65*xres(r), .85*yres(r))
  1360. cells <- cellFromXY(r, pts)
  1361. sel <- aggregate(pts, list(cells), function(i)i[1])
  1362. pts = sel[,c("X", "Y",'id')]
  1363.  
  1364. r = raster::shift(r, .8*xres(r), .5*yres(r))
  1365. cells <- cellFromXY(r, pts)
  1366. sel <- aggregate(pts, list(cells), function(i)i[1])
  1367. pts = sel[,c("X", "Y",'id')]
  1368.  
  1369. r = raster::shift(r, .85*xres(r), .55*yres(r))
  1370. cells <- cellFromXY(r, pts)
  1371. sel <- aggregate(pts, list(cells), function(i)i[1])
  1372. pts = sel[,c("X", "Y",'id')]
  1373.  
  1374. r = raster::shift(r, .5*xres(r), .8*yres(r))
  1375. cells <- cellFromXY(r, pts)
  1376. sel <- aggregate(pts, list(cells), function(i)i[1])
  1377. pts = sel[,c("X", "Y",'id')]
  1378.  
  1379. r = raster::shift(r, .55*xres(r), .85*yres(r))
  1380. cells <- cellFromXY(r, pts)
  1381. sel <- aggregate(pts, list(cells), function(i)i[1])
  1382. pts = sel[,c("X", "Y",'id')]
  1383.  
  1384. r = raster::shift(r, .8*xres(r), .4*yres(r))
  1385. cells <- cellFromXY(r, pts)
  1386. sel <- aggregate(pts, list(cells), function(i)i[1])
  1387. pts = sel[,c("X", "Y",'id')]
  1388.  
  1389. r = raster::shift(r, .85*xres(r), .45*yres(r))
  1390. cells <- cellFromXY(r, pts)
  1391. sel <- aggregate(pts, list(cells), function(i)i[1])
  1392. pts = sel[,c("X", "Y",'id')]
  1393.  
  1394. r = raster::shift(r, .4*xres(r), .8*yres(r))
  1395. cells <- cellFromXY(r, pts)
  1396. sel <- aggregate(pts, list(cells), function(i)i[1])
  1397. pts = sel[,c("X", "Y",'id')]
  1398.  
  1399. r = raster::shift(r, .45*xres(r), .85*yres(r))
  1400. cells <- cellFromXY(r, pts)
  1401. sel <- aggregate(pts, list(cells), function(i)i[1])
  1402. pts = sel[,c("X", "Y",'id')]
  1403.  
  1404. r = raster::shift(r, .8*xres(r), .3*yres(r))
  1405. cells <- cellFromXY(r, pts)
  1406. sel <- aggregate(pts, list(cells), function(i)i[1])
  1407. pts = sel[,c("X", "Y",'id')]
  1408.  
  1409. r = raster::shift(r, .85*xres(r), .35*yres(r))
  1410. cells <- cellFromXY(r, pts)
  1411. sel <- aggregate(pts, list(cells), function(i)i[1])
  1412. pts = sel[,c("X", "Y",'id')]
  1413.  
  1414. r = raster::shift(r, .3*xres(r), .8*yres(r))
  1415. cells <- cellFromXY(r, pts)
  1416. sel <- aggregate(pts, list(cells), function(i)i[1])
  1417. pts = sel[,c("X", "Y",'id')]
  1418.  
  1419. r = raster::shift(r, .35*xres(r), .85*yres(r))
  1420. cells <- cellFromXY(r, pts)
  1421. sel <- aggregate(pts, list(cells), function(i)i[1])
  1422. pts = sel[,c("X", "Y",'id')]
  1423.  
  1424. r = raster::shift(r, .8*xres(r), .2*yres(r))
  1425. cells <- cellFromXY(r, pts)
  1426. sel <- aggregate(pts, list(cells), function(i)i[1])
  1427. pts = sel[,c("X", "Y",'id')]
  1428.  
  1429. r = raster::shift(r, .85*xres(r), .25*yres(r))
  1430. cells <- cellFromXY(r, pts)
  1431. sel <- aggregate(pts, list(cells), function(i)i[1])
  1432. pts = sel[,c("X", "Y",'id')]
  1433.  
  1434. r = raster::shift(r, .2*xres(r), .8*yres(r))
  1435. cells <- cellFromXY(r, pts)
  1436. sel <- aggregate(pts, list(cells), function(i)i[1])
  1437. pts = sel[,c("X", "Y",'id')]
  1438.  
  1439. r = raster::shift(r, .25*xres(r), .85*yres(r))
  1440. cells <- cellFromXY(r, pts)
  1441. sel <- aggregate(pts, list(cells), function(i)i[1])
  1442. pts = sel[,c("X", "Y",'id')]
  1443.  
  1444. r = raster::shift(r, .8*xres(r), .8*yres(r))
  1445. cells <- cellFromXY(r, pts)
  1446. sel <- aggregate(pts, list(cells), function(i)i[1])
  1447. pts = sel[,c("X", "Y",'id')]
  1448.  
  1449. r = raster::shift(r, .85*xres(r), .85*yres(r))
  1450. cells <- cellFromXY(r, pts)
  1451. sel <- aggregate(pts, list(cells), function(i)i[1])
  1452. pts = sel[,c("X", "Y",'id')]
  1453.  
  1454. r = raster::shift(r, .8*xres(r), .8*yres(r))
  1455. cells <- cellFromXY(r, pts)
  1456. sel <- aggregate(pts, list(cells), function(i)i[1])
  1457. pts = sel[,c("X", "Y",'id')]
  1458.  
  1459. r = raster::shift(r, .85*xres(r), .85*yres(r))
  1460. cells <- cellFromXY(r, pts)
  1461. sel <- aggregate(pts, list(cells), function(i)i[1])
  1462. pts = sel[,c("X", "Y",'id')]
  1463.  
  1464. r = raster::shift(r, .9*xres(r), .9*yres(r))
  1465. cells <- cellFromXY(r, pts)
  1466. sel <- aggregate(pts, list(cells), function(i)i[1])
  1467. pts = sel[,c("X", "Y",'id')]
  1468.  
  1469. r = raster::shift(r, .95*xres(r), .95*yres(r))
  1470. cells <- cellFromXY(r, pts)
  1471. sel <- aggregate(pts, list(cells), function(i)i[1])
  1472. pts = sel[,c("X", "Y",'id')]
  1473.  
  1474. r = raster::shift(r, .9*xres(r), .9*yres(r))
  1475. cells <- cellFromXY(r, pts)
  1476. sel <- aggregate(pts, list(cells), function(i)i[1])
  1477. pts = sel[,c("X", "Y",'id')]
  1478.  
  1479. r = raster::shift(r, .95*xres(r), .95*yres(r))
  1480. cells <- cellFromXY(r, pts)
  1481. sel <- aggregate(pts, list(cells), function(i)i[1])
  1482. pts = sel[,c("X", "Y",'id')]
  1483.  
  1484. r = raster::shift(r, .9*xres(r), .8*yres(r))
  1485. cells <- cellFromXY(r, pts)
  1486. sel <- aggregate(pts, list(cells), function(i)i[1])
  1487. pts = sel[,c("X", "Y",'id')]
  1488.  
  1489. r = raster::shift(r, .95*xres(r), .85*yres(r))
  1490. cells <- cellFromXY(r, pts)
  1491. sel <- aggregate(pts, list(cells), function(i)i[1])
  1492. pts = sel[,c("X", "Y",'id')]
  1493.  
  1494. r = raster::shift(r, .8*xres(r), .9*yres(r))
  1495. cells <- cellFromXY(r, pts)
  1496. sel <- aggregate(pts, list(cells), function(i)i[1])
  1497. pts = sel[,c("X", "Y",'id')]
  1498.  
  1499. r = raster::shift(r, .85*xres(r), .95*yres(r))
  1500. cells <- cellFromXY(r, pts)
  1501. sel <- aggregate(pts, list(cells), function(i)i[1])
  1502. pts = sel[,c("X", "Y",'id')]
  1503.  
  1504. r = raster::shift(r, .9*xres(r), .7*yres(r))
  1505. cells <- cellFromXY(r, pts)
  1506. sel <- aggregate(pts, list(cells), function(i)i[1])
  1507. pts = sel[,c("X", "Y",'id')]
  1508.  
  1509. r = raster::shift(r, .95*xres(r), .75*yres(r))
  1510. cells <- cellFromXY(r, pts)
  1511. sel <- aggregate(pts, list(cells), function(i)i[1])
  1512. pts = sel[,c("X", "Y",'id')]
  1513.  
  1514. r = raster::shift(r, .7*xres(r), .9*yres(r))
  1515. cells <- cellFromXY(r, pts)
  1516. sel <- aggregate(pts, list(cells), function(i)i[1])
  1517. pts = sel[,c("X", "Y",'id')]
  1518.  
  1519. r = raster::shift(r, .75*xres(r), .95*yres(r))
  1520. cells <- cellFromXY(r, pts)
  1521. sel <- aggregate(pts, list(cells), function(i)i[1])
  1522. pts = sel[,c("X", "Y",'id')]
  1523.  
  1524. r = raster::shift(r, .9*xres(r), .6*yres(r))
  1525. cells <- cellFromXY(r, pts)
  1526. sel <- aggregate(pts, list(cells), function(i)i[1])
  1527. pts = sel[,c("X", "Y",'id')]
  1528.  
  1529. r = raster::shift(r, .95*xres(r), .65*yres(r))
  1530. cells <- cellFromXY(r, pts)
  1531. sel <- aggregate(pts, list(cells), function(i)i[1])
  1532. pts = sel[,c("X", "Y",'id')]
  1533.  
  1534. r = raster::shift(r, .6*xres(r), .9*yres(r))
  1535. cells <- cellFromXY(r, pts)
  1536. sel <- aggregate(pts, list(cells), function(i)i[1])
  1537. pts = sel[,c("X", "Y",'id')]
  1538.  
  1539. r = raster::shift(r, .65*xres(r), .95*yres(r))
  1540. cells <- cellFromXY(r, pts)
  1541. sel <- aggregate(pts, list(cells), function(i)i[1])
  1542. pts = sel[,c("X", "Y",'id')]
  1543.  
  1544. r = raster::shift(r, .9*xres(r), .5*yres(r))
  1545. cells <- cellFromXY(r, pts)
  1546. sel <- aggregate(pts, list(cells), function(i)i[1])
  1547. pts = sel[,c("X", "Y",'id')]
  1548.  
  1549. r = raster::shift(r, .95*xres(r), .55*yres(r))
  1550. cells <- cellFromXY(r, pts)
  1551. sel <- aggregate(pts, list(cells), function(i)i[1])
  1552. pts = sel[,c("X", "Y",'id')]
  1553.  
  1554. r = raster::shift(r, .5*xres(r), .9*yres(r))
  1555. cells <- cellFromXY(r, pts)
  1556. sel <- aggregate(pts, list(cells), function(i)i[1])
  1557. pts = sel[,c("X", "Y",'id')]
  1558.  
  1559. r = raster::shift(r, .55*xres(r), .95*yres(r))
  1560. cells <- cellFromXY(r, pts)
  1561. sel <- aggregate(pts, list(cells), function(i)i[1])
  1562. pts = sel[,c("X", "Y",'id')]
  1563.  
  1564. r = raster::shift(r, .9*xres(r), .4*yres(r))
  1565. cells <- cellFromXY(r, pts)
  1566. sel <- aggregate(pts, list(cells), function(i)i[1])
  1567. pts = sel[,c("X", "Y",'id')]
  1568.  
  1569. r = raster::shift(r, .95*xres(r), .45*yres(r))
  1570. cells <- cellFromXY(r, pts)
  1571. sel <- aggregate(pts, list(cells), function(i)i[1])
  1572. pts = sel[,c("X", "Y",'id')]
  1573.  
  1574. r = raster::shift(r, .4*xres(r), .9*yres(r))
  1575. cells <- cellFromXY(r, pts)
  1576. sel <- aggregate(pts, list(cells), function(i)i[1])
  1577. pts = sel[,c("X", "Y",'id')]
  1578.  
  1579. r = raster::shift(r, .45*xres(r), .95*yres(r))
  1580. cells <- cellFromXY(r, pts)
  1581. sel <- aggregate(pts, list(cells), function(i)i[1])
  1582. pts = sel[,c("X", "Y",'id')]
  1583.  
  1584. r = raster::shift(r, .9*xres(r), .3*yres(r))
  1585. cells <- cellFromXY(r, pts)
  1586. sel <- aggregate(pts, list(cells), function(i)i[1])
  1587. pts = sel[,c("X", "Y",'id')]
  1588.  
  1589. r = raster::shift(r, .95*xres(r), .35*yres(r))
  1590. cells <- cellFromXY(r, pts)
  1591. sel <- aggregate(pts, list(cells), function(i)i[1])
  1592. pts = sel[,c("X", "Y",'id')]
  1593.  
  1594. r = raster::shift(r, .3*xres(r), .9*yres(r))
  1595. cells <- cellFromXY(r, pts)
  1596. sel <- aggregate(pts, list(cells), function(i)i[1])
  1597. pts = sel[,c("X", "Y",'id')]
  1598.  
  1599. r = raster::shift(r, .35*xres(r), .95*yres(r))
  1600. cells <- cellFromXY(r, pts)
  1601. sel <- aggregate(pts, list(cells), function(i)i[1])
  1602. pts = sel[,c("X", "Y",'id')]
  1603.  
  1604. r = raster::shift(r, .9*xres(r), .2*yres(r))
  1605. cells <- cellFromXY(r, pts)
  1606. sel <- aggregate(pts, list(cells), function(i)i[1])
  1607. pts = sel[,c("X", "Y",'id')]
  1608.  
  1609. r = raster::shift(r, .95*xres(r), .25*yres(r))
  1610. cells <- cellFromXY(r, pts)
  1611. sel <- aggregate(pts, list(cells), function(i)i[1])
  1612. pts = sel[,c("X", "Y",'id')]
  1613.  
  1614. r = raster::shift(r, .2*xres(r), .9*yres(r))
  1615. cells <- cellFromXY(r, pts)
  1616. sel <- aggregate(pts, list(cells), function(i)i[1])
  1617. pts = sel[,c("X", "Y",'id')]
  1618.  
  1619. r = raster::shift(r, .25*xres(r), .95*yres(r))
  1620. cells <- cellFromXY(r, pts)
  1621. sel <- aggregate(pts, list(cells), function(i)i[1])
  1622. pts = sel[,c("X", "Y",'id')]
  1623.  
  1624. r = raster::shift(r, .9*xres(r), .9*yres(r))
  1625. cells <- cellFromXY(r, pts)
  1626. sel <- aggregate(pts, list(cells), function(i)i[1])
  1627. pts = sel[,c("X", "Y",'id')]
  1628.  
  1629. r = raster::shift(r, .95*xres(r), .95*yres(r))
  1630. cells <- cellFromXY(r, pts)
  1631. sel <- aggregate(pts, list(cells), function(i)i[1])
  1632. pts = sel[,c("X", "Y",'id')]
  1633.  
  1634. r
  1635. rm(r)
  1636. gc()
  1637.  
  1638. fwrite(sel[,-1],file = '~/data/points/test1.csv')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement