Skip to content

Commit

Permalink
offstats template update (#80)
Browse files Browse the repository at this point in the history
* offstats template update

* text changes

* accredited stats

* typo

* corrections

* management info template

* minor text correction

* offdev template

* corrections and typos

---------

Co-authored-by: Alan Yeung <[email protected]>
  • Loading branch information
alan-y and alan-y authored Feb 13, 2024
1 parent 86f8e4c commit 0d696ef
Show file tree
Hide file tree
Showing 35 changed files with 865 additions and 135 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ jobs:
config:
# Windows
- {os: windows-latest, r: 'release', allow_fail: false}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6', allow_fail: true}
# Linux
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release', allow_fail: true}
- {os: ubuntu-latest, r: 'release', allow_fail: false}
- {os: ubuntu-latest, r: '4.1.2', allow_fail: false}
- {os: ubuntu-latest, r: '4.0.2', allow_fail: false}
- {os: ubuntu-latest, r: '3.6.1', allow_fail: true}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: phstemplates
Title: PHS R Templates
Version: 1.1.1
Version: 1.2.0
Authors@R: c(
person("Public Health Scotland", , , "[email protected]", role = "cph"),
person("Alan", "Yeung", , "[email protected]", role = c("aut", "cre"),
Expand Down Expand Up @@ -34,4 +34,4 @@ Suggests:
tidyr
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# phstemplates 1.2.0

* Updated official statistics, accredited official statistics (formerly national statistics), official statistics in development and management information templates to 2024 versions.
* Removed the use of the captioner package in report templates as it is no longer on CRAN.

# phstemplates 1.1.1

* Added three Management information templates for Word documents, accessible through RStudio menu: a Management Info Report, A Management Info Summary, and, a Management Info One Page template.
Expand Down
3 changes: 1 addition & 2 deletions R/phs_report_docx.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ phs_report_docx <- function(toc = FALSE,

# Cover Page
cover_page <- officer::read_docx(cover) %>%
officer::body_replace_all_text("Title", title) %>%
officer::body_replace_all_text("Publication title", title) %>%
officer::body_replace_all_text("Subtitle", stitle) %>%
officer::body_replace_all_text("DD Month YYYY", dt)

Expand All @@ -132,7 +132,6 @@ phs_report_docx <- function(toc = FALSE,
# Combine Cover and Report
cover_page %>%
officer::cursor_end() %>%
officer::body_remove() %>%
officer::body_add_break() %>%
officer::body_add_xml(str = xml_elt) %>%
officer::set_doc_properties(title = title) %>%
Expand Down
3 changes: 1 addition & 2 deletions R/phstemplates.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
#' See the README on
#' \href{https://github.com/Public-Health-Scotland/phstemplates#readme}{GitHub}.
#'
#' @docType package
#' @name phstemplates
NULL
"_PACKAGE"
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
output:
phstemplates::phs_report_docx:
reference_docx: "phs-natstats-report.docx"
reference_docx: "phs-accstats-report.docx"
fig_caption: no
cover_page: "phs-natstats-cover.docx"
cover_page: "phs-accstats-cover.docx"
cover_title: "My Title"
cover_subtitle: "My Subtitle"
cover_date: "DD MM YYYY"
Expand All @@ -14,7 +14,6 @@ output:
knitr::opts_chunk$set(echo = FALSE, dpi = 300)
library(ggplot2)
library(scales)
library(captioner)
library(flextable)
library(officer)
library(magrittr)
Expand All @@ -35,6 +34,23 @@ table_data <- data.frame(
)
```

```{r table-data2, include = FALSE}
table_data2 <- data.frame(
stringsAsFactors = FALSE,
Table.Head = c(
"Table Body text\nIn tristique lobortis sagittis. Phasellus mollis mattis iaculis.",

Check warning on line 41 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=41,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 89 characters.

Check warning on line 41 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=41,col=89,[trailing_whitespace_linter] Trailing whitespace is superfluous.
"Table Body text\nIn tristique lobortis sagittis. Phasellus mollis mattis iaculis",

Check warning on line 42 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=42,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 88 characters.

Check warning on line 42 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=42,col=88,[trailing_whitespace_linter] Trailing whitespace is superfluous.
"Table Body"
),
Table.Head = c("Table Body text\nIn tristique lobortis sagittis. Phasellus mollis mattis iaculis.",

Check warning on line 45 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=45,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 101 characters.
"1. Table bullet\n numbered 1 (123)\n a. Table bullet\n numbered 2 (abc)",

Check warning on line 46 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=46,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 110 characters.
"2. Table bullet\n numbered 1 (123)\n a. Table bullet\n numbered 2 (abc)"),

Check warning on line 47 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=47,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 111 characters.
Table.Head = c("Table Body text\nIn tristique lobortis sagittis. Phasellus mollis mattis iaculis.",

Check warning on line 48 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=48,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 101 characters.
" • Table bullet 1\n • Table bullet 1\n ○ Table bullet 2\n ○ Table bullet 2",

Check warning on line 49 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=49,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 106 characters.
" • Table bullet 1\n • Table bullet 1\n ○ Table bullet 2\n ○ Table bullet 2")

Check warning on line 50 in inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd

View workflow job for this annotation

GitHub Actions / lint

file=inst/rmarkdown/templates/phs-accstats-report/skeleton/skeleton.Rmd,line=50,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 106 characters.
)
```

```{r figure, include = FALSE}
# Create a pseudo chart
yr <- c(rep("2014-15", times = 8), rep("2015-16", times = 8))
Expand Down Expand Up @@ -85,11 +101,6 @@ chart <- ggplot(data = chart_data,
axis.line = element_line(colour = "grey"),
axis.ticks = element_line(colour = "grey")
)
# Figure numbering using the captioner package
fig_nums <- captioner(prefix = "Figure", infix = ":")
fig_nums(name = "chart",
caption = "title ^1,2,\\*,\\ \\*\\*\\ +\\ footnote\\ reference^")
```

# Introduction
Expand All @@ -103,8 +114,8 @@ Praesent congue molestie nisi, ut congue dui mattis in. Vivamus vel urna risus.

# Main Points
<Div custom-style = "Bullet 1">In tristique lobortis sagittis. Phasellus mollis mattis iaculis. Vivamus nunc justo, finibus nec maximus vel, ultricies vel urna. Ut ac mi sit amet augue fringilla egestas et ut mauris. Morbi volutpat, felis vel egestas scelerisque, nunc purus auctor ligula, non lobortis nulla felis in tortor. In nec commodo sem.</Div>
<Div custom-style = "Bullet 1">Proin vitae vehicula purus. Cras consequat iaculis venenatis. Morbi vel risus vestibulum, aliquet mi in, volutpat massa. Sed urna sem, posuere eu semper vitae, ullamcorper quis leo. Mauris nisi metus, scelerisque sed urna eu, maximus porttitor ante. Sed scelerisque accumsan commodo. Sed interdum justo volutpat, sodales nisi sed, consectetur arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus.</Div>
<Div custom-style = "Bullet 1">Praesent congue molestie nisi, ut congue dui mattis in. Vivamus vel urna risus. Donec sed blandit ex. Donec vel aliquam velit, in vestibulum lectus.</Div>
<Div custom-style = "Bullet 2">Proin vitae vehicula purus. Cras consequat iaculis venenatis. Morbi vel risus vestibulum, aliquet mi in, volutpat massa. Sed urna sem, posuere eu semper vitae, ullamcorper quis leo. Mauris nisi metus, scelerisque sed urna eu, maximus porttitor ante. Sed scelerisque accumsan commodo. Sed interdum justo volutpat, sodales nisi sed, consectetur arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus.</Div>
<Div custom-style = "Bullet 1">Praesent congue molestie nisi, ut congue dui mattis in. **Vivamus vel urna risus**. Donec sed blandit ex. Donec vel aliquam velit, in vestibulum lectus.</Div>

\newpage

Expand Down Expand Up @@ -133,8 +144,8 @@ my_ft_format <- function(ft) {
part = "all")
}
headings <- list("Table Head", "Table Head", "Table Head", "Table Head",
"Table Head")
headings <- list("Table head", "Table head", "Table head", "Table head",
"Table head")
names(headings) <- names(table_data)
flextable(table_data, theme_fun = NULL) %>%
Expand All @@ -149,26 +160,46 @@ flextable(table_data, theme_fun = NULL) %>%

<br>

<Div custom-style = "Table or chart caption">`r fig_nums("chart")`</Div>
<Div custom-style = "Table or chart caption">Table or chart caption</Div>
```{r flextable-table-data2, ft.align = "left"}
headings2 <- list("Table Head", "Table Head", "Table Head")
names(headings2) <- names(table_data2)
flextable(table_data2, theme_fun = NULL) %>%
my_ft_format() %>%
set_header_labels(values = headings2) %>%
height(height = 0.236, part = "body") %>%
hrule(rule = "atleast", part = "body") %>%
width(width = 2.1) %>%
append_chunks(
part = "body", i = 3, j = 1,
as_chunk(" text + hyperlink",
props = fp_text(color = "#005c99", bold = TRUE, font.size = 12))
)
```

\newpage

<Div custom-style = "Table or chart caption">Figure 1: title ^1,2,\*,\ \*\*\ +\ footnote\ reference^</Div>
```{r chart, fig.width=7.18, fig.height=3.31, fig.cap="Appropriate ALT Text to be added."}
chart
```
<Div custom-style = "Footnote Text">
1 Footnote text one.

2 Footnote text two.
<Div custom-style = "Table or chart note">
1. \ \ \ Vivamus molestie massa in quam porttitor viverra. Nulla facilisi. Suspendisse fermentum metus justo, vel elementum ante rutrum eget.

\* Footnote text three.
2. \ \ \ Vivamus molestie massa in quam porttitor viverra. Nulla facilisi. Suspendisse fermentum metus justo, vel Vivamus molestie massa in quam porttitor viverra. Nulla facilisi. Suspendisse fermentum metus justo.

\*\* Footnote text four.
3. \ \ \ Vivamus molestie massa in quam porttitor viverra. Nulla facilisi. Suspendisse fermentum metus justo, vel elementum ante rutrum eget.
</Div>

<br>

### Heading 3
Fusce hendrerit nibh sit amet tellus tincidunt vehicula. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam non libero eu orci viverra rhoncus eu sed massa.

Mauris ac neque vel erat varius cursus. Praesent at molestie felis. Nunc eget ipsum non lectus facilisis dictum quis viverra magna. Pellentesque elementum condimentum accumsan. Nunc vel pharetra augue. Pellentesque vitae lectus cursus magna blandit aliquet. In aliquet sapien sit amet viverra aliquam.

Pellentesque aliquam imperdiet neque et interdum. Nulla sodales tellus magna, id venenatis justo pulvinar ut. Etiam luctus facilisis auctor. Curabitur interdum feugiat convallis. Nullam mi libero, hendrerit vitae condimentum in, iaculis porta purus. Suspendisse potenti. Donec sed molestie nisi, ut blandit ex. Proin tempor, mauris sit amet consectetur placerat, elit lorem placerat dui, sed placerat mi ante a purus.
Pellentesque aliquam imperdiet neque et interdum. Nulla sodales tellus magna, id venenatis justo pulvinar ut. Etiam luctus facilisis auctor. Curabitur interdum feugiat convallis. Nullam mi libero, hendrerit vitae condimentum in, iaculis porta purus.

Suspendisse potenti. Donec sed molestie nisi, ut blandit ex. Proin tempor, mauris sit amet consectetur placerat, elit lorem placerat dui, sed placerat mi ante a purus.

Expand All @@ -188,12 +219,12 @@ Glossary item description
\newpage

# Contact
**Name, Job Title**
**Name, Job title**
Service
Phone number
[[email protected]](mailto:[email protected])

**Name, Job Title**
**Name, Job title**
Service
Phone number
[[email protected]](mailto:[email protected])
Expand Down Expand Up @@ -280,7 +311,7 @@ DD Month YYYY
[Insert details about how these statistics can be compared]

**Accessibility**
It is the policy of Public Health Scotland to make its web sites and products accessible according to published guidelines. More information on accessibility can be found on the [PHS website](https://beta.isdscotland.org/front-matter/accessibility-statement/).
It is the policy of Public Health Scotland to make its web sites and products accessible according to published guidelines. More information on accessibility can be found on the [PHS website](https://publichealthscotland.scot/accessibility/).

**Coherence and clarity**
[Insert details about how the coherence and clarity of this publication]
Expand All @@ -291,10 +322,10 @@ It is the policy of Public Health Scotland to make its web sites and products ac
**Disclosure**
[Insert details about disclosure levels of risk in relation to this publication]

**Official Statistics designation**
Experimental Statistics
**Official Statistics accreditation**
Accredited official statistics

**UK Statistics Authority Assessment**
**UK Statistics Authority assessment**
[Insert details about the UK Stats Authority assessment of this publication]

**Last published**
Expand All @@ -317,30 +348,53 @@ DD Month YYYY

## Appendix 3 - Early access details

### Pre-Release Access
### Pre-release access

Under terms of the "Pre-Release Access to Official Statistics (Scotland) Order 2008", PHS is obliged to publish information on those receiving Pre-Release Access ("Pre-Release Access" refers to statistics in their final form prior to publication). The standard maximum Pre-Release Access is five working days. Shown below are details of those receiving standard Pre-Release Access.
Under terms of the 'Pre-release Access to Official Statistics (Scotland) Order 2008', PHS is obliged to publish information on those receiving pre-release access ('pre-release access' refers to statistics in their final form prior to publication). The standard maximum pre-release access is five working days. Shown below are details of those receiving standard pre-release access.

### Standard Pre-Release Access
### Standard pre-release access:

Scottish Government Health Department
Scottish Government Department of Health and Social Care (DHSC)

NHS Board Chief Executives
NHS board chief executives

NHS Board Communication leads
NHS board communication leads

### Early Access for Management Information
### Early access for management information

These statistics will also have been made available to those who needed access to 'management information', ie as part of the delivery of health and care:
These statistics will also have been made available to those who needed access to 'management information', i.e. as part of the delivery of health and care:

### Early Access for Quality Assurance
### Early access for quality assurance

These statistics will also have been made available to those who needed access to help quality assure the publication:

\newpage

## Appendix 4 – PHS and Official Statistics
## Appendix 4 – PHS and official statistics

### About Public Health Scotland (PHS)

PHS is a knowledge-based and intelligence driven organisation with a critical reliance on data and information to enable it to be an independent voice for the public's health, leading collaboratively and effectively across the Scottish public health system, accountable at local and national levels, and providing leadership and focus for achieving better health and wellbeing outcomes for the population. Our statistics comply with the [Code of Practice for Statistics](https://www.statisticsauthority.gov.uk/code-of-practice/the-code/) in terms of trustworthiness, high quality and public value. This also means that we keep data secure at all stages, through collection, processing, analysis and output production, and adhere to the '[five safes](https://blog.ons.gov.uk/2017/01/27/the-five-safes-data-privacy-at-ons/)'.
PHS is a knowledge-based and intelligence driven organisation with a critical reliance on data and information to enable it to be an independent voice for the public's health, leading collaboratively and effectively across the Scottish public health system, accountable at local and national levels, and providing leadership and focus for achieving better health and wellbeing outcomes for the population. Our statistics comply with the [Code of Practice for Statistics](https://www.statisticsauthority.gov.uk/code-of-practice/the-code/) in terms of trustworthiness, high quality and public value. This also means that we keep data secure at all stages, through collection, processing, analysis and output production, and adhere to the Office for National Statistics '[Five Safes](https://blog.ons.gov.uk/2017/01/27/the-five-safes-data-privacy-at-ons/)' of data privacy.

<br>

<br>

<br>

<br>

<br>

<br>

<br>

<br>

<Div custom-style = "*Other formats textbox (only for RMarkdown use)">
Translations and other formats are available on request at:
[email protected] or 0131 314 5300.

This publication is licensed for re-use under the [Open Government Licence v3.0](http://www.nationalarchives.gov.uk/doc/open-government-licence/). For more information, visit [www.publichealthscotland.scot/ogl](http://www.publichealthscotland.scot/ogl)
</Div>
3 changes: 3 additions & 0 deletions inst/rmarkdown/templates/phs-accstats-report/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: PHS Accredited Official Stats Report
description: Template to produce a PHS accredited official stats report document
create_dir: FALSE
Binary file not shown.
Loading

0 comments on commit 0d696ef

Please sign in to comment.