env_thin: Thinning of occurrence records using environmental...

View source: R/1.1b.f.occ.thin.R

env_thinR Documentation

Thinning of occurrence records using environmental information

Description

The function thins spatial points to minimize biases in the environmental space. It divides de range of variables into a desired number of @param bins and selects points closer to the bin center.

Usage

env_thin(
  p,
  predictors,
  long.col = NULL,
  lat.col = NULL,
  bins = 20,
  file = NULL,
  plot = F,
  verbose = F
)

Arguments

p

Two column matrix or data.frame with point coordinates or SpatialPoints of occurrence records.

predictors

Raster-class object of environmental predictor variables.

lat.col, long.col

Name of columns that contain coordinates (latitude and longitude)

bins

Number of bins to divide each environmental variable.

file

either a character string naming a file or a connection open for writing.

plot

Logical. Should results be plotted?

verbose

Logical. Should information be printed on screen?

Value

A data.frame, matrix, sp or sf object containing the selected records.

See Also

env_thin_b, load_env_thin_occ

Examples

## Not run: 
file <- paste(system.file(package="dismo"), "/ex/bradypus.csv", sep="")
bradypus <- read.table(file, header=TRUE, sep=',')
coord <- bradypus [,2:3]

# Download data for present
dir.create("rasters")
library(raster)
predictors <- getData('worldclim', var='bio', res=10, path="rasters")

#cor(data)
#vars <- ENMwizard::select_vars(cutoff = 0.9, corr.mat = cor(data), names.only = T)[[1]]
#length(vars)
env_thin(coord, predictors)

## End(Not run)


HemingNM/ENMwizard documentation built on Jan. 4, 2024, 3:24 p.m.