subsample.distance

0th

Percentile

Distance-based subsampling

Draws a minimum, and optional maximum constrained, distance sub-sampling

Usage
subsample.distance(
  x,
  size,
  d,
  d.max = NULL,
  replacement = FALSE,
  latlong = FALSE,
  echo = FALSE
)
Arguments
x

A spatial polygons or points sp object

size

Subsample size

d

Minimum sampling distance

d.max

Maximum sampling distance

replacement

(FALSE/TRUE) Subsample with replacement

latlong

(FALSE/TRUE) Is the data in a geographic projection

echo

(FALSE/TRUE) Print min and max sample distances

Value

A subsampled spatial polygons or points sp object

Note

This function provides a distance constrained subsample of existing point or polygon data

Aliases
  • subsample.distance
Examples
# NOT RUN {
     
# }
# NOT RUN {
library(sp)
data(meuse)
  coordinates(meuse) <- ~ x+y

# Subsample with a 500m minimum sample spread 
sub.meuse <- subsample.distance(meuse, size = 10, d = 500, echo = TRUE)  
  plot(meuse, pch=19, main="min dist = 500")
    points(sub.meuse, pch=19, col="red") 

# Check distances	
dm <- spDists(sub.meuse)
  diag(dm) <- NA
cat("\n", "Min distance for subsample", min(dm, na.rm=TRUE), "\n")  
cat("Max distance for subsample", max(dm, na.rm=TRUE), "\n") 

  # Subsample with a 500m minimum and 3500m maximum sample spread   
  sub.meuse <- subsample.distance(meuse, size = 10, d = 500, d.max = 3500)  
    plot(meuse,pch=19, main="min dist = 500, max dist = 3500")
      points(sub.meuse, pch=19, col="red") 

  # Check distances		
  dm <- spDists(sub.meuse)
    diag(dm) <- NA
  cat("Min distance for subsample", min(dm, na.rm=TRUE), "\n")  
  cat("Max distance for subsample", max(dm, na.rm=TRUE), "\n")    
# }
# NOT RUN {
# }
Documentation reproduced from package spatialEco, version 1.3-2, License: GPL-3

Community examples

Looks like there are no examples yet.