Skip to content

Commit

Permalink
minor changes for CRAN release
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Fox committed Jul 4, 2018
1 parent d821f85 commit 648306b
Show file tree
Hide file tree
Showing 8 changed files with 275 additions and 282 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: fingertipscharts
Type: Package
Version: 0.0.1.9000
Version: 0.0.1
Title: Produce Charts that you See on the Fingertips Website (<http://fingertips.phe.org.uk/>)
Description: User Fingertips charts to add the Fingertips theme to your markdown documents.
Author: c(person("Sebastian", "Fox", , "sebastian.fox@phe.gov.uk", c("aut", "cre")))
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# fingertipscharts 0.0.1

Due to popular demand, `fingertipscharts` has been created to help users create the charts they see on Public Health England's [Fingertips](https://fingertips.phe.org.uk/) website. There is an accompanying vignette that shows users the potential of the functions `browseVignettes("fingertipscharts")`
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ data on the website into their own outputs.

### CRAN

The package is not yet on CRAN.
Get the latest released, stable version from CRAN:

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

### With devtools

Expand All @@ -28,8 +32,7 @@ You can install the latest development version from github using
``` r
# install.packages("devtools")
devtools::install_github("PublicHealthEngland/fingertipscharts",
build_vignettes = TRUE,
dependencies = "suggests")
build_vignettes = TRUE)
```

### From zip
Expand Down Expand Up @@ -68,6 +71,8 @@ library(fingertipscharts)
library(dplyr)
df <- fingertips_data(90366) %>%
filter(Sex == "Male")
#> Warning: Unnamed `col_types` should have the same length as `col_names`.
#> Using smaller of the two.
p <- trends(df,
timeperiod = Timeperiod,
value = Value,
Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This package allows users to easily recreate visualisations seen on the [Fingert
## Test

* local Windows 7 install, R 3.5.0
* used Travis to check on Linux [INSERT DATE]
* used Travis to check on Linux (2018-7-4)

## R CMD check results

Expand Down
180 changes: 88 additions & 92 deletions tests/figs/population/full-pop-pyramid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
158 changes: 77 additions & 81 deletions tests/figs/population/no-comparator-pop-pyramid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
168 changes: 82 additions & 86 deletions tests/figs/population/one-comparator-pop-pyramid.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 15 additions & 18 deletions tests/testthat/test-population.R
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
context("population")

library(fingertipsR)
agelevels <- c("0-4", "5-9","10-14","15-19",
"20-24","25-29","30-34",
"35-39","40-44","45-49",
"50-54","55-59","60-64",
"65-69","70-74","75-79",
"80-84","85-89","90+")
pops <- fingertips_data(92708) %>%
filter(Timeperiod == "2015" &
Sex %in% c("Male", "Female") &
Age != "All ages") %>%
mutate(Age = gsub(" yrs","", Age),
Age = factor(Age,
levels = agelevels)) %>%
droplevels()
areas <- c("Area 1", "Area 2", "Area 3")
pops <- data.frame(Age = factor(rep(agelevels, length(areas) * 2), levels = agelevels),
Value = rep(sample(1000:3000, length(agelevels), replace = TRUE), length(areas) * 2),
Sex = rep(rep(c("Male", "Female"), each = length(agelevels)), length(areas)),
AreaName = rep(areas, each = length(agelevels) * 2))

full_p <- population(pops,
value = Value,
sex = Sex,
age = Age,
area = AreaName,
area_name = "Nottingham",
comparator_1 = "England",
comparator_2 = "East Midlands region",
area_name = "Area 1",
comparator_1 = "Area 3",
comparator_2 = "Area 2",
title = "Age Profile",
subtitle = paste(unique(pops$IndicatorName), unique(pops$Timeperiod)),
subtitle = "2015/16",
xlab = "% of total population")

one_comparator_p <- population(pops,
value = Value,
sex = Sex,
age = Age,
area = AreaName,
area_name = "Nottingham",
comparator_1 = "England",
area_name = "Area 1",
comparator_1 = "Area 3",
title = "Age Profile",
subtitle = paste(unique(pops$IndicatorName), unique(pops$Timeperiod)),
subtitle = "2015/16",
xlab = "% of total population")

no_comparator_p <- population(pops,
value = Value,
sex = Sex,
age = Age,
area = AreaName,
area_name = "Nottingham",
area_name = "Area 1",
title = "Age Profile",
subtitle = paste(unique(pops$IndicatorName), unique(pops$Timeperiod)),
subtitle = "2015/16",
xlab = "% of total population")

test_that("Error for missing area name works", {
Expand Down

0 comments on commit 648306b

Please sign in to comment.