Commit f436e0ce authored by Markus Mößler's avatar Markus Mößler
Browse files

added some test r scripts

parent de635f9a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -9,8 +9,9 @@ library(ggplot2)
library(plotly)

# -> 0) load data structure for qna
dataset <- "qna"
dataset <- "QNA"
url <- paste0("https://stats.oecd.org/restsdmx/sdmx.ashx/GetDataStructure/", dataset)
url <- paste0("https://stats.oecd.org/restsdmx/sdmx.ashx/GetDataStructure/", dataset, "/all?format=SDMX-ML")
data_structure <- readsdmx::read_sdmx(url)
data_structure %>%
  filter(id == c("CL_QNA_SUBJECT"),
+27 −0
Original line number Diff line number Diff line
readsdmx__read_sdmx <- function (path, destfile = tempfile(fileext = ".xml"), quiet = TRUE, 
                                 method = "libcurl", mode = "w", ...) {
  
  path <- url
  url
  "http://stats.oecd.org/restsdmx/sdmx.ashx/GetDataStructure/QNA/all?format=SDMX-ML"
  destfile <- tempfile(fileext = ".xml")
  quiet <- TRUE
  method <- "libcurl"
  mode <- "w"
  
  
  
  if (readsdmx:::is_url(path)) {
    if (!capabilities("libcurl") && method == "libcurl"){
      method <- "auto"
    } 
    # df <- download.file(path, destfile, method, quiet, mode, ...)
    df <- download.file(path, destfile, method, quiet, mode)
    stopifnot(df == 0L)
    path <- destfile
  }
  stopifnot(file.exists(path))
  path <- normalizePath(path)
  d <- read_sdmx_(path)
  as.data.frame(d, stringsAsFactors = FALSE)
}