Write auxiliary files to CSV and JSON (Tabular Data Package RFC specifications)

Usage

datapackage(var, format = NULL, dir = ".")

Arguments

var
character array of HarvestChoice indicator code(s)
format
file extension corresponding to the data package output format. See genFile. If NULL no auxiliary file is produced aside from metadata records in meta.csv.
dir
character, optional output directory. Default to current working directory.

Value

character array of generated auxiliary file names

Description

Auxiliary files and metadata are appended to all data packages, but may also be generated separately. Variable metadata is made available in tabular (.csv) and in JSON (.json) format in conformity with Tabular Data Package RFC specifications at http://dataprotocols.org/tabular-data-package/.

Details

API call: Generate auxiliary files for soil organic carbon concentration and 2012 total population

$ curl http://hcapi.harvestchoice.org/ocpu/library/hcapi3/R/datapackage \ -d '{"var" : ["soc_d5", "PN12_TOT"]}' \ -X POST -H 'Content-Type:application/json'

Examples

# Generate auxiliary files for soil organic carbon concentration and 2012 total population x <- datapackage(c("soc_d5", "PN12_TOT")) x <- fread(x[1]) x
code label 1: soc_d5 Soil org. carbon (0-5cm) 2: PN12_TOT Total Pop. '12 description 1: Soil organic carbon content (fine earth fraction) at 0-5cm depth. 2: Total population downscaled from LandScan 2012 population counts at 30 arc-second to 5 arc-minute resolution. type unit version 1: continuous permilles SChEF r2.5 2: continuous persons SChEF r2.5 aggFormula period category 1: sum(soc_d5*cpland_mean_ha, na.rm=T)/sum(cpland_mean_ha, na.rm=T) 1950 - 2012 Agroecology 2: sum(PN12_TOT, na.rm=TRUE) 2012 Demographics subcategory item 1: Soil Resources Soil Fertility 2: Population Total source 1: ISRIC (2014) ""World Soil Information"", in collaboration with The Earth Institute, Columbia University World Agroforestry Centre, Nairobi and the International Center for Tropical Agriculture (CIAT) 2: Bright, E. A. and Rose, A. N. (2012) ""LandScan Global Population Database 2012"", Oak Ridge National Laboratory, July 2013. Retrieved from http://web.ornl.gov/sci/landscan/. contact downloadedOn 1: j.koo@cgiar.org 07/30/2016 2: m.bacou@cgiar.org 07/30/2016 citation 1: HarvestChoice, 2015. ""Soil Organic Carbon Content (depth 0-5cm)"", International Food Policy Research Institute, Washington, DC., and University of Minnesota, St. Paul, MN. Available online at http://harvestchoice.org/data/soc_d5. 2: HarvestChoice, 2015. ""Population, Total (2012)"", International Food Policy Research Institute, Washington, DC., and University of Minnesota, St. Paul, MN. Available online at http://harvestchoice.org/data/PN12_TOT.

See also

indicator and category for other convenience methods to query HarvestChoice metadata.