Skip to content

Commit

Permalink
0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
evanodell committed Aug 3, 2018
1 parent f8943c8 commit d18be7d
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 27 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: nomisr
Type: Package
Title: Access 'Nomis' UK Labour Market Data
Version: 0.3.2
Version: 0.4.0
Authors@R: c(
person(
"Evan", "Odell", email = "evanodell91@gmail.com", role = c("aut", "cre"),
Expand Down Expand Up @@ -30,7 +30,7 @@ Imports:
utils,
rsdmx,
rlang
RoxygenNote: 6.0.1
RoxygenNote: 6.1.0
Suggests:
knitr,
rmarkdown,
Expand All @@ -39,3 +39,4 @@ Suggests:
tidyr,
magrittr
VignetteBuilder: knitr
Encoding: UTF-8
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

* Some minor changes to internal code for easier maintenance

* Documentation updates to clarify difference between `time` and `date`
parameters in `nomis_get_data()`


# nomisr 0.3.2 (non-CRAN release)

Expand Down Expand Up @@ -40,7 +43,7 @@ more persistently.
## New features and function changes

* New `nomis_codelist()` function, which returns the internal coding for
different concepts used by the NOMIS API in a \code{tibble}, given a dataset
different concepts used by the NOMIS API in a `tibble`, given a dataset
ID and a concept name.

* The `additional_queries` parameter in `nomis_get_data()` and
Expand Down
19 changes: 10 additions & 9 deletions R/data_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#'
#' @param id The ID of the dataset to retrieve.
#'
#' @param time Parameter for selecting dates and date ranges. Accepts either a
#' single date value, or two date values and returns all data between the two
#' @param time Parameter for selecting dates and date ranges. Accepts either a
#' single date value, or two date values and returns all data between the two
#' date values, There are two styles of values that can be used to query time.
#'
#' The first is one or two of \code{"latest"} (returns the latest available
Expand All @@ -51,12 +51,13 @@
#'
#' Defaults to \code{NULL}.
#'
#' @param date Parameter for selecting specific dates. Accepts one or more date
#' values. If given multiple values, only data for the given dates will be
#' returned, but there is no limit to the number of data values. For example,
#' \code{date=c("latest,latestMINUS3,latestMINUS6")} will return the latest
#' data, data from three months prior to the latest data and six months prior
#' to the latest data. There are two styles of values that can be used to query time.
#' @param date Parameter for selecting specific dates. Accepts one or more date
#' values. If given multiple values, only data for the given dates will be
#' returned, but there is no limit to the number of data values. For example,
#' \code{date=c("latest, latestMINUS3, latestMINUS6")} will return the latest
#' data, data from three months prior to the latest data and six months prior
#' to the latest data. There are two styles of values that can be used to
#' query time.
#'
#' The first is one or more of \code{"latest"} (returns the latest available
#' data), \code{"previous"} (the date prior to \code{"latest"}),
Expand Down Expand Up @@ -112,7 +113,7 @@
#' excluding all others. \code{select} is not case sensitive.
#'
#' @param tidy Logical parameter. If \code{TRUE}, converts variable names to
#' \code{snake_case}, or another style as specified by the
#' \code{snake_case}, or another style as specified by the
#' \code{tidy_style} parameter. Defaults to \code{FALSE}.
#'
#' @param tidy_style The style to convert variable names to, if
Expand Down
3 changes: 2 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

This is an update of the `nomisr` package, version number 0.4.0.
This version has new `tidy` and `tidy_style` parameters in the
`nomis_get_data()` function, improvements to the handling of
`nomis_get_data()` function, improvements to documentation, and a CITATION
file that now refers to the package's JOSS paper.

## Test environments
* local OS X install, R 3.5.1
Expand Down
20 changes: 13 additions & 7 deletions man/nomis_get_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/nomisr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-codelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ context("test-codelist.R")

test_that("nomis_codelist is working", {
skip_on_cran()

codelist <- nomis_codelist("NM_1_1", "SEX")
expect_type(codelist, "list")
expect_true(tibble::is_tibble(codelist))
Expand Down
11 changes: 6 additions & 5 deletions tests/testthat/test_get_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_that("nomis_get_data return expected format", {
## Test queries of over 25000 observatiosn
a <- nomis_get_data(
id = "NM_893_1", date = "latest",
geography = "TYPE266", exclude_missing = FALSE, tidy= TRUE
geography = "TYPE266", exclude_missing = FALSE, tidy = TRUE
)
expect_length(a, 40)
expect_type(a, "list")
Expand All @@ -31,7 +31,8 @@ test_that("nomis_get_data return expected format", {
expect_error(nomis_get_data(), "Dataset ID must be specified")

expect_message(
b <- nomis_get_data(tidy = TRUE,
b <- nomis_get_data(
tidy = TRUE,
id = "NM_168_1", time = "latest",
geography = "2013265925", sex = "0", additional_queries = ""
), "The `additional_query` parameter is
Expand Down Expand Up @@ -60,7 +61,7 @@ test_that("nomis_get_data return expected format", {
))

x_select <- nomis_get_data(
id = "NM_168_1", time = "latest",
id = "NM_168_1", time = "latest",
geography = "2013265925", sex = "0",
select = c(
"geography_code", "C_OCCPUK11H_0_NAME",
Expand All @@ -72,14 +73,14 @@ test_that("nomis_get_data return expected format", {
expect_true(tibble::is_tibble(x_select))

mort_data1 <- nomis_get_data(
id = "NM_161_1", date = "2016", tidy= TRUE,
id = "NM_161_1", date = "2016", tidy = TRUE,
geography = "TYPE464",
CAUSE_OF_DEATH = "10381",
sex = 0, age = 0, MEASURE = 6
)

mort_data2 <- nomis_get_data(
id = "NM_161_1", date = "2016", tidy= TRUE,
id = "NM_161_1", date = "2016", tidy = TRUE,
geography = "TYPE464", sex = 0,
cause_of_death = "10381",
age = 0, measure = 6, measures = NULL
Expand Down

0 comments on commit d18be7d

Please sign in to comment.