Thanks Mel and Lauren for your replies. Very helpful indeed.
From: "Bacou, Melanie" <m...@mbacou.com>
Reply-To: "m...@mbacou.com" <m...@mbacou.com>
Date: Tuesday, October 24, 2017 at 10:37 AM
To: Andy Bunn <andy.b...@wwu.edu>, R-sig-Geo <r-sig-geo@r-proje
Sorry the exact code is:
xy.r <- extract(r, xy.sp)
xy.r.sample <- lapply(xy.r, sample, 10)
On 10/24/2017 01:34 PM, Bacou, Melanie
wrote:
Andy,
Simple use `extract()` instead of `mask()`, and then randomly
sample cells
Andy,
Simple use `extract()` instead of `mask()`, and then randomly
sample cells in each polygon. Should be much faster, e.g.:
xy.r <- extract(r, xy.sp)
xy.r.sample <- lapply(xy.r, sample.int, n=10)
--Mel.
On 10/23/2017 12:57 PM, Andy Bunn
Hi Andy,
I've gotten around this before using package 'sf' and list-columns,
here's a workflow using your data:
library(sf)
library(tidyverse)
xy.sf <- st_as_sf(xy.sp) %>%
mutate(ID = 1:nrow(.)) # need at least one attribute
xy.sf.s <- xy.sf %>%
# get intersecting cells
Hi all, I’ve followed the thread on the updates to raster and would like to
acknowledge the wonderful work done by Robert and others in making raster. It
is an amazing piece of software. Thanks to all who help people like me do my
job using the fruits of your labors!
Anyways, I’m working with