Commit 1c6c0a19 authored by Pauline Maury Laribière's avatar Pauline Maury Laribière
Browse files

hash format output

parent 3dec8494
Pipeline #268920 passed with stage
in 21 seconds
library(httr)
library(jsonlite)
res <- GET("https://www.i14y.admin.ch/api/ContentConfigurations")
json <- fromJSON(rawToChar(res$content))
names(json)
json$identifier
res <- GET("https://www.i14y.admin.ch/api/ContentConfigurations/HCL_CH_ISCO_19_PROF")
cc <- fromJSON(rawToChar(res$content))
res <- GET("https://www.i14y.admin.ch/api/Nomenclatures/Childnodes/HCL_CH_ISCO_19_PROF/fr/.?additionalProp1=string")
ncn <- fromJSON(rawToChar(res$content))
data1 <- read.csv("https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/levelexport/CSV?level=1&annotations=true&additionalProp2=string&language=fr")
data2 <- read.csv("https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/multiplelevels/CSV?language=fr&levelFrom=1&levelTo=4&annotations=true&additionalProp1=string")
library(httr)
library(jsonlite)
library(rsdmx)
library(hash)
sdmx_request <- function(url) {
as.data.frame(readSDMX(myUrl))
}
json_request <- function(url) {
fromJSON(rawToChar(GET(url)$content))
}
csv_request <- function(url) {
read.csv(url)
}
REQUEST_FUNCTION_MAPPING <- hash(
"sdmx" = sdmx_request,
"json" = json_request,
"csv" = csv_request
)
json <- fromJSON(rawToChar(GET("https://www.i14y.admin.ch/api/ContentConfigurations")$content))
names(json)
json$identifier
res <- GET("https://www.i14y.admin.ch/api/ContentConfigurations/HCL_CH_ISCO_19_PROF")
cc <- fromJSON(rawToChar(res$content))
res <- GET("https://www.i14y.admin.ch/api/Nomenclatures/Childnodes/HCL_CH_ISCO_19_PROF/fr/.?additionalProp1=string")
ncn <- fromJSON(rawToChar(res$content))
data1 <- read.csv("https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/levelexport/CSV?level=1&annotations=true&additionalProp2=string&language=fr")
h[['csv']]("https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/levelexport/CSV?level=1&annotations=true&additionalProp2=string&language=fr")
data2 <- read.csv("https://www.i14y.admin.ch/api/Nomenclatures/HCL_CH_ISCO_19_PROF/multiplelevels/CSV?language=fr&levelFrom=1&levelTo=4&annotations=true&additionalProp1=string")
myUrl <- "https://www.i14y.admin.ch/api/CodeLists/CL_NOGA_SECTION/exports/SDMX-ML/2.1?annotations=true"
dataset <- as.data.frame(readSDMX(myUrl))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment