Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial CRAN release #103

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
^data-raw$
^doc$
^Meta$
^cran-comments\.md$
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Type: Package
Package: dfeR
Title: Common DfE R tasks
Version: 0.6.1.9000
Title: Common Department for Education Analysis Tasks
Version: 1.0.0
Authors@R: c(
person("Cam", "Race", , "[email protected]", role = c("aut", "cre")),
person("Department for Education, UK", "[email protected]", role = "cph"),
person("Laura", "Selby", , "[email protected]", role = "aut"),
person("Adam", "Robinson", role = "aut"),
person("Jen", "Machin", , "[email protected]", role = "ctb"),
Expand All @@ -12,9 +13,9 @@ Authors@R: c(
comment = c(ORCID = "0000-0001-9070-9969")),
person("Menna", "Zayed", , "[email protected]", role = "ctb")
)
Description: This package contains R functions to allow DfE analysts to
re-use code for common analytical tasks that are undertaken across the
Department.
Description: Preferred methods for common analytical tasks that are
undertaken across the Department, including number formatting, project
templates and curated reference data.
License: GPL (>= 3)
URL: https://dfe-analytical-services.github.io/dfeR/,
https://github.com/dfe-analytical-services/dfeR
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# dfeR (development version)
# dfeR 1.0.0

Added lookup data geog_time_identifiers
Initial CRAN release.
Added lookup data geog_time_identifiers.
Added z_replace() to replace NA values in tables except for ones in geography and time columns that match ones in geog_time_identifiers.

# dfeR 0.6.1
Expand Down
5 changes: 4 additions & 1 deletion R/create_project.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ create_project <- function(


# Create the readme -----
file.copy("README_template.md", file.path(path, "README.md"))
file.copy(
system.file(package = "dfeR", "README_template.md"),
file.path(path, "README.md")
)

# .renvignore
file.create(paste0(path, "/.renvignore"))
Expand Down
2 changes: 1 addition & 1 deletion R/datasets_documentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,5 @@
#' @format ## `geog_time_identifiers`
#' A character vector with 38 potential column names in snake case format.
#' @source curated by explore.statistics@@education.gov.uk.
#' \href{https://shorturl.at/j4532}{Get guidance on time and geography data.}
#' \href{https://www.shorturl.at/j4532}{Guidance on time and geography data.}
"geog_time_identifiers"
4 changes: 4 additions & 0 deletions R/datasets_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#' data frame from R memory
#'
#' @keywords internal
#' @noRd
#' @return a data frame of a tidied lookup file
tidy_raw_lookup <- function(raw_lookup_file) {
if (!is.data.frame(raw_lookup_file)) {
Expand Down Expand Up @@ -142,6 +143,7 @@ tidy_raw_lookup <- function(raw_lookup_file) {
#' usually the output of tidy_raw_lookup
#'
#' @return single data.frame of all lookup files combined
#' @noRd
create_time_series_lookup <- function(lookups_list) {
# Input validation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Added some quick checks based on the assumptions we make in this function
Expand Down Expand Up @@ -234,6 +236,7 @@ create_time_series_lookup <- function(lookups_list) {
#' @return data.frame for the individual year of the lookup
#'
#' @keywords internal
#' @noRd
get_wd_pcon_lad_la <- function(year) {
# Crude way to grab 2 digits, works for anything that isn't in the noughties
year_end <- year %% 100
Expand Down Expand Up @@ -304,6 +307,7 @@ get_wd_pcon_lad_la <- function(year) {
#' @return data.frame for the individual year of the lookup
#'
#' @keywords internal
#' @noRd
get_lad_region <- function(year) {
# Crude way to grab 2 digits, works for anything that isn't in the noughties
year_end <- year %% 100
Expand Down
2 changes: 2 additions & 0 deletions R/fetch_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#'
#' @return nothing, unless a failure, and then it will give an error
#' @keywords internal
#' @noRd
check_fetch_location_inputs <- function(year_input, country_input) {
if (year_input != "All") {
if (!grepl("^\\d{4}$", as.character(year_input))) {
Expand Down Expand Up @@ -39,6 +40,7 @@ check_fetch_location_inputs <- function(year_input, country_input) {
#'
#' @return a data frame of location names and codes
#' @keywords internal
#' @noRd
fetch_locations <- function(lookup_data, cols, year, countries) {
# Return only the cols we specified
# We know their position from the dplyr selection of the lookup
Expand Down
2 changes: 1 addition & 1 deletion R/get_ons_api_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' Geography Portal
#' @param query_params query parameters to pass into the API, see the ESRI
#' documentation for more information on query parameters -
#' \href{https://shorturl.at/5xrJT}{ESRI Query (Feature Service/Layer)}
#' \href{https://www.shorturl.at/5xrJT}{ESRI Query (Feature Service/Layer)}
#' @param batch_size the number of rows per query. This is 250 by default, if
#' you hit errors then try lowering this. The API has a limit of 1000 to 2000
#' rows per query, and in truth, the actual limit for our method is lower as
Expand Down
2 changes: 1 addition & 1 deletion R/z_replace.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @description
#' Replaces `NA` values in tables except for ones in time and geography
#' columns that must be included in DfE official statistics.
#' \href{https://shorturl.at/chy76}{Get more guidance on Open Data Standards.}
#' \href{https://www.shorturl.at/chy76}{Guidance on our Open Data Standards.}
#'
#' @details

Expand Down
14 changes: 10 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ knitr::opts_chunk$set(
)
```

# dfeR <a href="http://dfe-analytical-services.github.io/dfeR/"><img src="man/figures/logo.png" align="right" height="138" /></a>
# dfeR <a href="https://dfe-analytical-services.github.io/dfeR/"><img src="man/figures/logo.png" align="right" height="138" /></a>

<!-- badges: start -->
[![R-CMD-check](https://github.com/dfe-analytical-services/dfeR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/dfe-analytical-services/dfeR/actions/workflows/R-CMD-check.yaml)
Expand All @@ -38,7 +38,7 @@ Functionality for dfeR is expected to focus around the following:
4. API wrappers commonly needed in DfE analysis (where they don't have their own separate package)
5. Geography lookup files and helper functions

Documentation for what has been included in the package so far is on our [pkgdown site](http://dfe-analytical-services.github.io/dfeR/).
Documentation for what has been included in the package so far is on our [pkgdown site](https://dfe-analytical-services.github.io/dfeR/).

### Relevant other packages

Expand All @@ -54,7 +54,13 @@ While we have some DfE specific data in the dfeR package taken from the [Open Ge

## Installation

dfeR is not currently available on CRAN. For the time being you can install the development version from GitHub.
dfeR is available on CRAN and you can install directly from there:

``` r
install.packages("dfeR")
```

You can install the development version from GitHub.

If you are using [renv](https://rstudio.github.io/renv/articles/renv.html) in your project (recommended):

Expand All @@ -73,7 +79,7 @@ devtools::install_github("dfe-analytical-services/dfeR")

## Proxy

The need for setting proxy settings in order to be able to work with R and Git within the DfE estate has now ended. If you previously run the proxy script in previous versions of the dfeR package, then contact the [Statistics Development Team]([email protected]) to assist in cleaning out your system settings.
The need for setting proxy settings in order to be able to work with R and Git within the DfE estate has now ended. If you previously run the proxy script in previous versions of the dfeR package, then contact the [Statistics Development Team](mailto:[email protected]) to assist in cleaning out your system settings.

---

Expand Down
Loading
Loading