Skip to contents

Get the environmental variables for each species occurrences and pseudo-absences at given point locations by extracting the environmental information from the prediction table produced from the get_predict_table function see also help(get_predict_table).

Usage

get_modelfit_table(
  data,
  spec,
  lon,
  lat,
  pseudoabs = NULL,
  subc,
  predict_table,
  mod_fit_table,
  read = TRUE,
  quiet = TRUE
)

Arguments

data

a data.frame or data.table that contains the columns regarding the species name and the longitude / latitude coordinates in WGS84.

spec

character. The name of the column with the species names.

lon

character. The name of the column with the longitude coordinates.

lat

character. The name of the column with the latitude coordinates.

pseudoabs

integer. number of pseudo-absences

subc

character. Full path to the sub-catchment .tif file with the sub-catchment ID.

predict_table

character. Full path of the predict.csv table (i.e., output of get_predict_table); see also help(get_predict_table)

mod_fit_table

character. Full path of the output.csv table, i.e., the model fit table file.

read

logical. If TRUE, then the model .csv table gets read into R as data.table and data.frame. if FALSE, the table is only stored on disk. Default is FALSE.

quiet

logical. If FALSE, the standard output will be printed. Default is TRUE.

Author

Jaime Garcia Marquez, Thomas Tomiczek

Examples

# Download test data into the temporary R folder
# or define a different directory
my_directory <- tempdir()
download_test_data(my_directory)

# Load occurrence data

# Define full path to the sub-catchments raster layer

# Define full path to the prediction table
predict_tbl <- paste0(my_directory,
                     "/hydrography90m_test_data/projectionTB.csv")

# Define full path to the output model fit table
model_fit <- paste0(my_directory,
                     "/hydrography90m_test_data/model_table.csv")

# Get table with environmental variables at each occurrence
# and pseudo-absence point location
modelfit_table <- get_modelfit_table(data = species_occurrence,
                                  spec = "species",
                                  lon = "long",
                                  lat = "lat",
                                  pseudoabs = 10000,
                                  subc = subc_raster,
                                  predict_table =  predict_tbl,
                                  mod_fit_table = model_fit)