columnParse {voluModel} | R Documentation |
Column Parsing
Description
Parses column names from input occurrence
data.frame
for more seamless function
Usage
columnParse(occs, wDepth = FALSE)
Arguments
occs |
A |
wDepth |
Logical; flags whether a depth column should also be sought. |
Details
This is an internal function to return the putative indices for latitude and longitude or x and y coordinates of occurrences to allow for code that is more robust to very common user error
Value
A list
of length 2 with indices of the x and y
columns, respectively, followed by a message with a plain
text report of which columns were interpreted as x and y.
Examples
library(terra)
# Create sample raster
r <- rast(ncol=10, nrow=10)
values(r) <- 1:100
# Create test occurrences
set.seed(0)
longitude <- sample(ext(r)[1]:ext(r)[2],
size = 10, replace = FALSE)
set.seed(0)
latitude <- sample(ext(r)[3]:ext(r)[4],
size = 10, replace = FALSE)
set.seed(0)
depth <- sample(0:35, size = 10, replace = TRUE)
occurrences <- as.data.frame(cbind(longitude,latitude,depth))
# Here's the function
result <- columnParse(occs = occurrences[,1:2],
wDepth = FALSE)
result <- columnParse(occs = occurrences,
wDepth = TRUE)
[Package voluModel version 0.2.2 Index]