FAOSTATpackage
FAOSTATpackage copied to clipboard
Out of date API?
I'm having trouble pulling data from TM with the getFAOtoSYB(). I run the following search to get the appropriate TM codes:
FAOsearch() # 2; 3; 0; All; 4
I then pass the results to the getFAOtoSYB function:
getFAOtoSYB(query = .LastSearch)
I end up with the following errors:
getFAOtoSYB(query = .LastSearch)
------------------------------------------ ** FAOSTAT Data Download (422 in Total) ** ------------------------------------------
(1): Downloading variable Detailed trade matrix_Wool, hair waste_Import Quantity (tonnes) ... Error in faoData$FAOST_CODE : $ operator is invalid for atomic vectors [1] 1 Error : $ operator is invalid for atomic vectors [1] 2 Error : $ operator is invalid for atomic vectors [1] 3 Error : $ operator is invalid for atomic vectors [1] 4 ...
See Filippo's commend in issue #23
I updated this gist which provides two functions
-
download_faostat_bulk
loads zip files from the FAOSTAT bulk download -
read_faostat_bulk
reads the data in data frames.