sampleTransect: Sample transect

View source: R/sampleTransect.R

sampleTransectR Documentation

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

Details

Function create lines and samples using random or defined direction and length transects and then creates a point sample along each transect. The characteristic of the sample points are defined by arguments passed to the sf::st_sample function. The distance and azimuth arguments allow for specifying the exact length and direction for each points transect.

Value

A list object contaning sf LINES and POINTS objects representing random transects and sample points along each transect. The "ID" column links the resulting data.

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

if(require(sp, quietly = TRUE)) {
library(sf)
  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)

} else { 
  cat("Please install sp package to run example", "\n")
}


spatialEco documentation built on Nov. 18, 2023, 1:13 a.m.