Skip to content

Instantly share code, notes, and snippets.

@bttomio
Created May 17, 2021 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bttomio/9b68a4a0b6e24847201efa7235e0d082 to your computer and use it in GitHub Desktop.
Save bttomio/9b68a4a0b6e24847201efa7235e0d082 to your computer and use it in GitHub Desktop.
# Monthly historical series of soybean, sunflower and corn prices
library(IMFData)
library(tidyverse)
availableDB <- DataflowMethod()
availableDB$DatabaseID
PCPS.available.codes <- DataStructureMethod("PCPS")
names(PCPS.available.codes)
PCPS_area <- PCPS.available.codes[[2]]
PCPS_indicators <- PCPS.available.codes[[3]]
databaseID <- "PCPS"
startdate = "1990-01-01"
enddate = "2020-01-01"
checkquery = FALSE
# PMAIZMT - Primary Commodity Prices, Corn
queryfilter <- list(CL_FREQ = "M", CL_AREA_PCPS = "",
CL_INDICATOR_PCPS = "PMAIZMT", CL_UNIT_PCPS = "USD")
PMAIZMTdf <- CompactDataMethod(databaseID, queryfilter, startdate,
enddate, checkquery, tidy = TRUE)
# PSUNO - Primary Commodity Prices, Sunflower Oil
queryfilter <- list(CL_FREQ = "M", CL_AREA_PCPS = "",
CL_INDICATOR_PCPS = "PSUNO", CL_UNIT_PCPS = "USD")
PSUNOdf <- CompactDataMethod(databaseID, queryfilter, startdate,
enddate, checkquery, tidy = TRUE)
# PSOYB - Primary Commodity Prices, Soybeans
queryfilter <- list(CL_FREQ = "M", CL_AREA_PCPS = "",
CL_INDICATOR_PCPS = "PSOYB", CL_UNIT_PCPS = "USD")
PSOYBdf <- CompactDataMethod(databaseID, queryfilter, startdate,
enddate, checkquery, tidy = TRUE)
# PSOIL - Primary Commodity Prices, Soybeans Oil
queryfilter <- list(CL_FREQ = "M", CL_AREA_PCPS = "",
CL_INDICATOR_PCPS = "PSOIL", CL_UNIT_PCPS = "USD")
PSOILdf <- CompactDataMethod(databaseID, queryfilter, startdate,
enddate, checkquery, tidy = TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment