Learn R Programming

Rnightlights (version 0.2.4)

myZonal: Calculate zonal statistics. Used internally

Description

Calculate zonal statistics. Used internally by zonalpipe. Modified from http://www.guru-gis.net/efficient-zonal-statistics-using-r-and-gdal/

Usage

myZonal(rast, nlType, configName, zone, nlStats, digits = 0,
  retVal = NULL, na.rm = TRUE, ...)

Arguments

rast

the country raster

nlType

the nlType of interest

configName

character the type of raster being processed

zone

the zonal country polygon layer

nlStats

a character list of statistics to calculate

digits

round off to how many decimals

retVal

Whether to return the raster data as a vector, or data.frame with spatial context NULL returns a vector of all values, colrowval returns a data.frame with row, col and raster value while lonlatval returns a data.frame with lon,lat and val.

na.rm

how to handle NAs

...

Other params to pass to the nlStats functions e.g. na.rm

Value

numeric value result of the given nlStat function