Rank agricultural productions across geographies

Usage

genRank(var = "h", by = "ISO3", ...)

Arguments

var
one or several of "harvested area", "production", or "value of production". These argument can be abbreviated to "h", "p" or "v". May be expanded in the future to include additional sub-groups of indicators.
by
by default returns aggregate production across all selected countries. by may be specified to return aggregates across sub-zones (e.g. across provinces, districts, agro-ecological zones, etc.), see examples.
...
optional arguments passed to hcapi, e.g. iso3 and wkt

Value

data.table(s) of commodities ranked from top to bottom

Description

Returns top and bottom commodities in terms of aggregate production, harvested area, and/or value of production.

Details

API call: rank commodities in Angola and Mozambique by harvested area and production

$ curl http://hcapi.harvestchoice.org/ocpu/library/hcapi3/R/genRank/json \ -d '{"var" : ["h", "p"], "iso3" : ["AGO", "MOZ"]}' \ -X POST -H 'Content-Type:application/json'

API call: rank commodities across Angola's agro-ecological zones by production

$ curl http://hcapi.harvestchoice.org/ocpu/library/hcapi3/R/genRank/json \ -d '{"var" : "p", "iso3" : "AGO", "by" : "AEZ5_CLAS"}' \ -X POST -H 'Content-Type:application/json'

Examples

# Rank commodities in Angola and Mozambique by harvested area and production x <- genRank(c("h", "p"), iso3=c("AGO", "MOZ"))
Error in eval(expr, envir, enclos): object 'value' not found
x
[1] 0
# Rank commodities across Angola's agro-ecological zones by production x <- genRank("p", iso3="AGO", by="AEZ5_CLAS")
Error in eval(expr, envir, enclos): object 'value' not found
x
[1] 0

See also

hcapi