abmR, you must first install it from Github using
devtools and load the library:
# devtools: install_github("bgoch5/abmR") # If install gives errors, try running the following: # Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS="true") library(abmR,quietly=TRUE,warn.conflicts=FALSE)
While this package is still in development, it will be updated frequently, so please be sure to re-install frequently. Installing
abmR will also automaticaly install its dependencies, if you don’t already have them installed. These include
The modeling functions discussed in section 2 require two input objects to work, which we will discuss here.
Example data that will be used in this Vignette and other package documentation can be downloaded using
get_ex_data(). This function will download to your hard drive (to a location specified by your current working directory) the below NDVI raster files, totaling approximately 620 MB. The first time you use this function, you will be directed to your browser and required to sign in to your Google account to connect to the Tidyverse API. If you use the function a second time, you may simply follow the prompts and enter a number corresponding to the previous accounts listed.
Once you have the data downloaded, you must read it into R using commands like the following.
You may instead use your own environmental raster data - NDVI or otherwise - and read it into R in a similar way. Please refer to the file “Aggregating Environmental Rasters.R” on the
abmR Github page for an example on how you might create a final rasterstack from a group of NOAA NDVI .nc files.
ndvi_raster_EU=stack("C:/Users/BGOCHANOUR/Documents/GitHub/move-model/Data/2013 NDVI/NDVI_2013_Europe") ndvi_raster_EU_composite=raster("C:/Users/BGOCHANOUR/Documents/GitHub/move-model/Data/2013 NDVI/NDVI_2013_Europe_composite")
We can now quickly examine our raster data to see if it read in correctly.
The first raster is a 27-layer stack (of which we will plot the first four layers), and the second is a composite raster formed by taking the mean of all layers.
plot(ndvi_raster_EU[[1:4]]) # First four layers of 27 layer RasterStack