Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grd = spsample(data_n, type = "regular",n=10000)
- n_yield = sapply(1:length(grd), function(pt) {
- d = spDistsN1(data_n, grd[pt,])
- return(mean(data_n[d < 5,]$yield_n))
- })
- n_dat = data.frame(coordinates(grd), n_yield)
- datNoNas <- na.omit(object = n_dat)
- # mapping in ggplot
- ggplot(aes(x = x1, y = x2,fill = n_yield), data = datNoNas) +
- geom_tile() +
- scale_fill_gradientn(colours = rainbow(4)) +
- coord_equal()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement