Description Usage Arguments Value Examples
View source: R/rarify_points.R
Take a set of spatial points data, and sample them according the the raster grid.
Points will be sampled so a specified number of points per grid cell remains.
Number of points is defined by points_number argument (still experimental if points_number > 1).
1  | rarify_points(point_data, raster_data, points_number = 1, return = "sf")
 | 
point_data | 
 Point data to rarify. Should be of class sp.  | 
raster_data | 
 Raster grid used to sample points. Raster* object.  | 
points_number | 
 Number of points to sample per grid cell. Default is 1. Using points_number > 1 is still experimental.  | 
return | 
 Type of object to return. One of   | 
Spatial point data. Either sp or sf class.
1 2 3 4 5 6  | library(LUpak)
bioclim_mask <- raster(milkunize("Temp/Korea_mask_crop.tif"))
korea_points <-  shapefile(milkunize("Temp/Korea_points_crop.shp"))
my_crops_rarified <- rarify_points(korea_points, bioclim_mask)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.