Returns top and bottom commodities in terms of aggregate production, harvested area, and/or value of production.
genRank(var = "h", by = "ISO3", ...)
by
may be specified to return aggregates across sub-zones (e.g. across provinces,
districts, agro-ecological zones, etc.), see examples.hcapi
, e.g. iso3
and wkt
data.table(s) of commodities ranked from top to bottom
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'
# Rank commodities in Angola and Mozambique by harvested area and production x <- genRank(c("h", "p"), iso3=c("AGO", "MOZ"))#> Warning: the condition has length > 1 and only the first element will be used#> Warning: the condition has length > 1 and only the first element will be used#> Warning: To be consistent with reshape2's melt, id.vars and measure.vars are internally guessed when both are 'NULL'. All non-numeric/integer/logical type columns are conisdered id.vars, which in this case are columns [ADM0_NAME, ISO3.1]. Consider providing at least one of 'id' or 'measure' vars in future.#> Error in eval(expr, envir, enclos): object 'value' not foundx#> Error in eval(expr, envir, enclos): object 'x' not found# Rank commodities across Angola's agro-ecological zones by production x <- genRank("p", iso3="AGO", by="AEZ5_CLAS")#> Warning: To be consistent with reshape2's melt, id.vars and measure.vars are internally guessed when both are 'NULL'. All non-numeric/integer/logical type columns are conisdered id.vars, which in this case are columns [ADM0_NAME, AEZ5_CLAS]. Consider providing at least one of 'id' or 'measure' vars in future.#> Error in eval(expr, envir, enclos): object 'value' not foundx#> Error in eval(expr, envir, enclos): object 'x' not found