[R-br] FAOSTAT
Alisson Lucrécio
alisson.lucrecio em ifgoiano.edu.br
Domingo Fevereiro 25 23:58:06 -03 2018
Caro Colegas,
Bom dia.
Tentei usar o pacote FAOSTAT para baixar dados da FAO, mas não funcionar.
Eu acho que tem um erro no código arableLand ou domainCode.
Vocês saberiam o que eu poderia fazer para resolver esse erro?
Obrigado.
--
Alisson Lucrecio da Costa
--------------------------
library(FAOSTAT)
FAOquery.df = data.frame(varName = c("arableLand", "cerealExp",
"cerealProd"),
domainCode = c("RL", "TP", "QC"),
itemCode = c(6621, 1944, 1717),
elementCode = c(5110, 5922, 5510),
stringsAsFactors = FALSE)
## Download the data from FAOSTAT
FAO.lst = with(FAOquery.df,
getFAOtoSYB(name = varName, domainCode = domainCode,
itemCode = itemCode, elementCode = elementCode,
useCHMT = TRUE, outputFormat = "wide"))
FAO.lst$entity[, "arableLand"] = as.numeric(FAO.lst$entity[, "arableLand"])
--------------------------
library(FAOSTAT)
>
> FAOquery.df = data.frame(varName = c("arableLand", "cerealExp",
"cerealProd"),
+ domainCode = c("RL", "TP", "QC"),
+ itemCode = c(6621, 1944, 1717),
+ elementCode = c(5110, 5922, 5510),
+ stringsAsFactors = FALSE)
>
> ## Download the data from FAOSTAT
> FAO.lst = with(FAOquery.df,
+ getFAOtoSYB(name = varName, domainCode = domainCode,
+ itemCode = itemCode, elementCode = elementCode,
+ useCHMT = TRUE, outputFormat = "wide"))
----------------------------------------
** FAOSTAT Data Download (3
in Total) **
----------------------------------------
(1): Downloading variable arableLand ... The specified query has no data,
consult FAOSTAT
(2): Downloading variable cerealExp ...
NOTE: Multiple China detected in 'Value' sanitization is performed
OK
(3): Downloading variable cerealProd ... The specified query has no data,
consult FAOSTAT
Number of variables successfully downloaded: 1 out of 3
> FAO.lst$entity[, "arableLand"] = as.numeric(FAO.lst$entity[,
"arableLand"])
Error in `[.data.frame`(FAO.lst$entity, , "arableLand") :
undefined columns selected
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20180225/c5adde36/attachment.html>
Mais detalhes sobre a lista de discussão R-br