rarify_points: Rarify points

Description Usage Arguments Value Examples

View source: R/rarify_points.R

Description

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).

Usage

1
rarify_points(point_data, raster_data, points_number = 1, return = "sf")

Arguments

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 c("sf", "sp"). Default is "sf".

Value

Spatial point data. Either sp or sf class.

Examples

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)

MirzaCengic/LUpak documentation built on July 18, 2019, 3:06 a.m.