-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starting process of developing more functions, fleshing out the packa…
…ge and purpose
- Loading branch information
Showing
16 changed files
with
154 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
Package: nomisr | ||
Type: Package | ||
Title: What the Package Does in One 'Title Case' Line | ||
Version: 1.0 | ||
Title: Access nomis data on UK labour market statistics with R | ||
Version: 0.0.0.9000 | ||
Date: 2018-01-19 | ||
Author: Your Name | ||
Maintainer: Your Name <your@email.com> | ||
Description: One paragraph description of what the package does as one or more full sentences. | ||
License: GPL (>= 2) | ||
Imports: Rcpp (>= 0.12.14) | ||
Authors@R: person("Evan Odell", email="evanodell91@gmail.com", | ||
role=c("aut", "cre"), | ||
comment = c(ORCID='0000-0003-1845-808X')) | ||
Author: Evan Odell [aut, cre] | ||
Maintainer: Evan Odell <evanodell91@gmail.com> | ||
Description: Access UK labour market official statistics from the nomis | ||
database | ||
License: GPL-3 | ||
Imports: | ||
Rcpp (>= 0.12.14), | ||
jsonlite, | ||
tibble | ||
LinkingTo: Rcpp | ||
RoxygenNote: 6.0.1 | ||
Suggests: | ||
knitr, | ||
rmarkdown, | ||
testthat | ||
VignetteBuilder: knitr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
useDynLib(nomisr, .registration=TRUE) | ||
exportPattern("^[[:alpha:]]+") | ||
importFrom(Rcpp, evalCpp) | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(nomis_data) | ||
import(jsonlite) | ||
import(tibble) | ||
importFrom(Rcpp,sourceCpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
|
||
|
||
nomis_data_access <- function(id){ | ||
|
||
q <- jsonlite::fromJSON("https://www.nomisweb.co.uk/api/v01/dataset/NM_1_1.jsonstat.json?", flatten = T) | ||
|
||
|
||
} | ||
|
||
|
||
#results <- fromJSONstat("https://www.nomisweb.co.uk/api/v01/dataset/NM_1_1.jsonstat.json?") | ||
##investigate this JSONstat package further - currently 2 years since anything has been done to it, it is still the best way forward? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
## retrieve all available data sets or the information available in a specific dataset based on its ID | ||
|
||
|
||
#' Title | ||
#' | ||
#' @param id Dataset ID | ||
#' | ||
# @return | ||
#' @export | ||
#' | ||
# @examples | ||
nomis_data <- function(id){ | ||
|
||
if(missing(id)){ | ||
|
||
query <- "/def.sdmx.json" | ||
|
||
} else { | ||
|
||
query <- paste0("/",id,"/def.sdmx.json") | ||
|
||
} | ||
|
||
df <- nomis_query_util(query) | ||
|
||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
#' nomisr: Access nomis data on UK labour market statistics with R | ||
|
||
#' Documentation available at \url{https://www.nomisweb.co.uk/api/v01/help} | ||
|
||
# Docs: https://www.nomisweb.co.uk/api/v01/help | ||
|
||
#' @docType package | ||
#' @name nmisr | ||
#' @import jsonlite | ||
#' @import tibble | ||
# @useDynLib nomisr | ||
#' @importFrom Rcpp sourceCpp | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
|
||
## utility function to download data - may need to expand as time goes on | ||
|
||
nomis_collect_util <- function(query){ | ||
|
||
q <- jsonlite::fromJSON(paste0(collect_root, query), flatten = TRUE) | ||
|
||
#df <- tibble::as.tibble(q$structure$keyfamilies$keyfamily) | ||
|
||
#df | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
## utility function to query - may need to expand as time goes on | ||
|
||
|
||
nomis_query_util <- function(query){ | ||
|
||
q <- jsonlite::fromJSON(paste0(query_root, query), flatten = TRUE) | ||
|
||
df <- tibble::as.tibble(q$structure$keyfamilies$keyfamily) | ||
|
||
df | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## utility object | ||
|
||
# the basic url for all data queries | ||
query_root <- "https://www.nomisweb.co.uk/api/v01/dataset" | ||
|
||
# the basic url for all data downloads | ||
collect_root <- "https://www.nomisweb.co.uk/api/v01/dataset" | ||
|
||
p_load(rjstat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
library(testthat) | ||
library(nomisr) | ||
|
||
test_check("nomisr") |