rnd_locations {conleyreg}R Documentation

Random location drawing

Description

This function draws random locations in longlat format.

Usage

rnd_locations(
  nobs,
  xmin = -180,
  xmax = 180,
  ymin = -90,
  ymax = 90,
  output_type = c("data.table", "data.frame", "sf")
)

Arguments

nobs

number of observations

xmin

minimum longitude

xmax

maximum longitude

ymin

minimum latitude

ymax

maximum latitude

output_type

type of output object. Either "data.table" (default), "data.frame", or "sf".

Details

By default, this function draws a global sample of random locations. You can restrict it to a certain region via specifying xmin, xmax, ymin, and ymax. The function draws from a uniform spatial distribution that assumes the planet to be a perfect sphere. The spherical assumption is common in GIS functions, but deviates from Earth's exact shape.

Value

Returns a data.table, data.frame, or sf object of unprojected (longlat) points.

Examples

data <- rnd_locations(1000)


[Package conleyreg version 0.1.7 Index]