Create a zonal file if it does not exist and calculate the zonal stats by calling the myZonal function. Modified from http://www.guru-gis.net/efficient-zonal-statistics-using-r-and-gdal/
ZonalPipe(ctryCode, admLevel, ctryPoly, nlType, configName, path.in.shp,
path.in.r, path.out.r, path.out.shp, zone.attribute, nlStats,
gadmVersion = pkgOptions("gadmVersion"),
gadmPolyType = pkgOptions("gadmPolyType"), custPolyPath = NULL)
the ctryCode of interest
The country admin level of interest
the SpatialPolygonsDataFrame country polygon to process
character The nlType of interest
character the type of raster being processed
The path to the country shapefile
The path to the raster tile
The path where to save the output zonal raster
The path to save the output zonal shapefile (Ignored)
The zonal attribute to calculate
The stats to calculate
The GADM version to use
The format of polygons to download from GADM
Alternative to GADM. A path to a custom shapefile zip
TRUE/FALSE