From d18be7db73031f754e6065fdf8fe926c5199ca24 Mon Sep 17 00:00:00 2001 From: evan Date: Fri, 3 Aug 2018 10:31:55 +0100 Subject: [PATCH] 0.4.0 --- DESCRIPTION | 5 +++-- NEWS.md | 5 ++++- R/data_download.R | 19 ++++++++++--------- cran-comments.md | 3 ++- man/nomis_get_data.Rd | 20 +++++++++++++------- man/nomisr.Rd | 1 - tests/testthat/test-codelist.R | 2 +- tests/testthat/test_get_data.R | 11 ++++++----- 8 files changed, 39 insertions(+), 27 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 90f6c6a..08b9b99 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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"), @@ -30,7 +30,7 @@ Imports: utils, rsdmx, rlang -RoxygenNote: 6.0.1 +RoxygenNote: 6.1.0 Suggests: knitr, rmarkdown, @@ -39,3 +39,4 @@ Suggests: tidyr, magrittr VignetteBuilder: knitr +Encoding: UTF-8 diff --git a/NEWS.md b/NEWS.md index 6a5b24a..9515c46 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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) @@ -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 diff --git a/R/data_download.R b/R/data_download.R index c9709e7..9594fdc 100644 --- a/R/data_download.R +++ b/R/data_download.R @@ -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 @@ -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"}), @@ -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 diff --git a/cran-comments.md b/cran-comments.md index 7b6ba97..1710555 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -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 diff --git a/man/nomis_get_data.Rd b/man/nomis_get_data.Rd index db33b97..4cbdc56 100644 --- a/man/nomis_get_data.Rd +++ b/man/nomis_get_data.Rd @@ -12,10 +12,11 @@ nomis_get_data(id, time = NULL, date = NULL, geography = NULL, \arguments{ \item{id}{The ID of the dataset to retrieve.} -\item{time}{Parameter for selecting dates and date ranges. There are two -styles of values that can be used to query time. +\item{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 more of \code{"latest"} (returns the latest available +The first is one or two of \code{"latest"} (returns the latest available data), \code{"previous"} (the date prior to \code{"latest"}), \code{"prevyear"} (the date one year prior to \code{"latest"}) or \code{"first"} (the oldest available data for the dataset). @@ -30,8 +31,13 @@ on the the \code{date} parameter. Defaults to \code{NULL}.} -\item{date}{Parameter for selecting specific dates. There are two styles -of values that can be used to query time. +\item{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"}), @@ -66,7 +72,7 @@ Defaults to \code{NULL}, equivalent to \code{c(5,6,7)} for datasets where sex is an option. For datasets using \code{"C_SEX"}, \code{0} will return results for males and females, \code{1} only males and \code{2} only females. Some datasets use \code{"GENDER"} with the same -values as \code{"SEX"}, which works with both \code{sex} and +values as \code{"SEX"}, which works with both \code{sex = } and \code{gender = } as a dot parameter.} \item{measures}{The code for the statistical measure(s) to include in the @@ -87,7 +93,7 @@ Defaults to \code{FALSE}.} excluding all others. \code{select} is not case sensitive.} \item{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}.} \item{tidy_style}{The style to convert variable names to, if diff --git a/man/nomisr.Rd b/man/nomisr.Rd index ae0ca9f..965b5b0 100644 --- a/man/nomisr.Rd +++ b/man/nomisr.Rd @@ -3,7 +3,6 @@ \docType{package} \name{nomisr} \alias{nomisr-package} -\alias{nomisr-package} \title{nomisr: Access Nomis UK Labour Market Data with R} \description{ Access UK official statistics from the Nomis database. Nomis diff --git a/tests/testthat/test-codelist.R b/tests/testthat/test-codelist.R index 86f19e5..dd80565 100644 --- a/tests/testthat/test-codelist.R +++ b/tests/testthat/test-codelist.R @@ -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)) diff --git a/tests/testthat/test_get_data.R b/tests/testthat/test_get_data.R index 028ed40..3b5c3e4 100644 --- a/tests/testthat/test_get_data.R +++ b/tests/testthat/test_get_data.R @@ -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") @@ -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 @@ -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", @@ -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