Description Usage Arguments Details Value Author(s) Examples
View source: R/Preprocessing.R
Create env file as an input for SamBada (it is recommended to run prepare_env function before running samBada) raster file(s) and/or global database present in the raster r package
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
locationFileName |
char Name of the file containing location of individuals. Must be in the active directory. Supported extension are .csv, .shp. All columns present in this file will also be present in the output file |
outputFile |
char Name of the output file. Must have a .csv extension. |
x |
char Name of the x (or longitude if not projected coordinate system) column in the |
y |
char Name of the y (or latitude if not projected coordinate system) column in the |
locationProj |
integer Coordinate system EPSG code of the |
separator |
char The separator used to separate columns in your |
worldclim |
logical If TRUE worldclim bio, tmin, tmax and prec variables will be downloaded at a resolution of 0.5 minutes of degree (the finest resolution). Rely rgdal and gdalUtils R package to merge the tiles. The downloaded tiles will be stored in the (new) wc0.5 directory of the active directory |
resWC |
double The resolution at which to download the worldclim tiles. Must be one of 0.5, 2.5, 5, and 10 (minutes of degree). See argument res of raster::getData. |
srtm |
logical If TRUE the SRTM (altitude) variables will be downloaded at a resolution ... Rely rgdal and gdalUtils R package to merge the tiles. The downloaded tiles will be stored in the (new) wc0.5 directory of the active directory |
saveDownload |
logical If TRUE (and if |
rasterName |
char or list Name or list of name of raster files to import. Supported format are the one of raster package. If |
rasterProj |
integer or list of integer Coordinate system EPSG code of the rasterlayer. If rasterlayer is already georeferenced, this argument will be skipped. If |
directory |
logical If true, all .tif, .gtiff, .img, .sdat, . present in |
interactiveChecks |
logical If TRUE, shows loaded rasters and point locations |
verbose |
logical If TRUE, indication on process will be shown |
If you set worldclim=TRUE, then tmin10 represents the minimum temperature in October. Similarly tmax, tavg and prec refers to maximum temperature, average temperature and precipitation. The bio1-bio19 are bioclim variables are computed from these indices and are described here. Temperature are given in 10 degree C and precipitation in mm. The function always downloads the best resolution available (30 seconds for worldclim dataset and 90m for SRTM). This function requires that you define the EPSG code of your projection system. If you work with lat/long global projection, then you most probably work with WGS 84 whose EPSG is 4326.
In order to work, this function needs GDAL to be installed on your machine (requirements of the package rgdal)
None
Solange Duruz
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
# Worldclim download only with sample data from R.SamBada
createEnv(locationFileName=system.file("extdata", "uganda-subset.csv", package = "R.SamBada"),
outputFile=file.path(tempdir(),'uganda-subset-env.csv'), x='longitude',y='latitude',
locationProj=4326, worldclim=TRUE,saveDownload=FALSE,interactiveChecks=TRUE)
# Own raster (fictitious examples) + worldclim download
createEnv(rasterName=c('prec.tif','tmin.sdat'),locationFileName='MyFile.shp',
outputFile='MyFile-env.csv', rasterProj=c(4326,21781), worldclim=TRUE,
saveDownload=TRUE,interactiveChecks=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.