This function generates automatic summary stats of pixel level
or admin level population comparisons from the compare_pop
(a raster brick), or the aggregate_to_shp
(an sf object).
summary_compare( comp_obj, select_pops = NULL, funs = list(sum = function(x) sum(x, na.rm = TRUE), mean = function(x) mean(x, na.rm = TRUE), max = function(x) max(x, na.rm = TRUE), min = function(x) min(x, na.rm = TRUE), sd = function(x) sd(x, na.rm = TRUE), length_nas = function(x) sum(is.na(x))) )
comp_obj | sf or RasterBrick object generated by comparison functions (see Details) |
---|---|
select_pops | a numeric or character vector of either numeric indices or colum names, defaults to all population columns (i.e. ones with the prefix "popcmp") |
funs | list of functions, you can pass your own with a single parameter x or you can use the defaults (sum, mean, max, min, sd, and length_nas) |
a table with the rows corresponding to the summary stats and the columns the population datasets