cpc2fcl: CPC to FCL Codes

Description Usage Arguments Value Examples

Description

This function maps CPC to FCL codes using the table defined within the SWS.

Usage

1
cpc2fcl(cpcCodes, returnFirst = FALSE, version = "latest")

Arguments

cpcCodes

A character vector containing the CPC codes.

returnFirst

Logical. If one CPC code maps to multiple FCL codes, we have no way of correctly mapping a single code without more information. The code is designed to throw an error at this point, but if you want to force a result (and return the lowest numerical code of all the matches) then set this to TRUE. In that case, only a warning will be issued if this type of mapping occurs. In general, setting this to TRUE is bad practice. However, the mapping at the time of this writing is entirely one-to-one except for maize, which is mapped to maize, white maize, and popcorn. It's probably not very bad to ignore this issue.

version

character. This specifies the version of the conversion tables between fcl and cpc. To use the latest version, you can use 'latest'. The other tables available are '2.1preliminary', the default one and '2.1' which is the update and official one.

Value

A character vector whose ith element is the FCL code corresponding to the passed CPC code in position i. If no valid mapping is found, an NA is returned in this place.

Examples

1
2
3
4
5
## Not run: 
cpc2fcl(c("0111", "23110", "01447"))
cpc2fcl(fcl2cpc(c("0015", "0016", "0265")))

## End(Not run)

SWS-Methodology/faoswsUtil documentation built on May 9, 2019, 11:53 a.m.