head(CalibDataBat2)
str(CalibDataBat2)
## The following example require to have downloaded
## an elevation raster with the function getelev()
## and will therefore not run unless you uncomment it
# if (require(terra)){
# ## We delete the elevation data
# CalibDataBat2$elev <- NULL
#
# ## We reconstruct the elevation data using an elevation raster
# getelev(file = "elevBats.tif", z = 6,
# lat_min = min(CalibDataBat2$lat),
# lat_max = max(CalibDataBat2$lat),
# long_min = min(CalibDataBat2$long),
# long_max = max(CalibDataBat2$long))
# ElevationRasterBig <- rast("elevBats.tif")
# CalibDataBat2$elev <- extract(
# ElevationRasterBig,
# cbind(CalibDataBat2$long, CalibDataBat2$lat))
# head(CalibDataBat2)
# }
Run the code above in your browser using DataLab