## ----setup, include=FALSE-----------------------------------------------------
# Authenticated live-service examples are never executed during R CMD check.
knitr::opts_chunk$set(eval = FALSE, collapse = TRUE, comment = "#>")

## ----load---------------------------------------------------------------------
# library(tuiksdmx)

## ----discovery----------------------------------------------------------------
# flows <- tuik_search_dataflows("tüketici", limit = 10)
# flows
# 
# flow <- tuik_get_dataflow("DF_TUFE_SDMX_TT01")
# flow

## ----profile------------------------------------------------------------------
# profile <- tuik_flow_profile("DF_TUFE_SDMX_TT01")
# names(profile)
# profile$dataflow

## ----overview-----------------------------------------------------------------
# tuik_explore(profile)
# tuik_filter_dimensions(profile)

## ----coded-dimensions---------------------------------------------------------
# # Dimension metadata and its referenced Codelist
# tuik_filter_dimensions(profile)
# 
# # Theoretical codes and descriptions for one dimension
# tuik_dimension_codes(profile, "DEGISIM")
# 
# # Search a dimension's defined values
# tuik_explore(profile, dimension = "COICOP_2018", search = "gıda")

## ----structural-tables--------------------------------------------------------
# profile$dimensions
# profile$measures
# profile$attributes

## ----raw-dsd------------------------------------------------------------------
# # Follow the *actual reference*, rather than guessing a DSD ID.
# ref <- profile$dataflow
# raw_dsd <- tuik_get_dsd(
#   dsd_id = ref$dsd_id,
#   agency = ref$dsd_agency,
#   version = ref$dsd_version
# )
# 
# # Extract structural components from the XML document
# tuik_dimensions(raw_dsd)
# tuik_measures(raw_dsd)
# tuik_attributes(raw_dsd)

## ----selections---------------------------------------------------------------
# chosen <- list(REF_AREA = "TR", FREQ = "M", DEGISIM = "1")
# 
# tuik_explore(profile, filters = chosen)
# tuik_missing_filters(profile, chosen)

## ----validation---------------------------------------------------------------
# tuik_validate_filters(profile, chosen)

