Learn R Programming

spatialEco (version 2.0-1)

sampleTransect: Sample transect

Description

Creates random transects from points and generates sample points along each transect

Usage

sampleTransect(
  x,
  min.dist,
  max.dist,
  distance = NULL,
  azimuth = NULL,
  id = NULL,
  ...
)

Arguments

x

A sf point object

min.dist

Minimum length of transect(s)

max.dist

Maximum length of transect(s)

distance

A vector of distances, same length as x, used to define transect distances (length)

azimuth

A vector of azimuths, same length as x, used to define transect direction

id

A unique identification column in x

...

Additional arguments passed to st_sample

Author

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

Run this code

library(sf)
if(require(sp, quietly = TRUE)) {
  data(meuse, package = "sp")
  meuse <- st_as_sf(meuse, coords = c("x", "y"), crs = 28992, 
                    agr = "constant")
}
meuse <- meuse[sample(1:nrow(meuse),10),]

transects <- sampleTransect(meuse, min.dist=200, max.dist=500, 
                            type="regular", size=20)
   plot(st_geometry(transects$transects))
     plot(st_geometry(meuse), pch=19, cex=2, add=TRUE)
       plot(st_geometry(transects$samples), 
	        col="red", pch=19, add=TRUE)

Run the code above in your browser using DataLab