Skip to content

Commit

Permalink
Fixing some notes from R CMD check
Browse files Browse the repository at this point in the history
  • Loading branch information
minifiemj committed Dec 6, 2024
1 parent 19eb681 commit f388ded
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 50 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
^docs$
^pkgdown$
^\.github$
^LICENSE\.md$
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Authors@R: person("Matthew", "Minifie", email = "minifiemj@gmail.com", role = c(
Description: Creates Excel spreadsheets which align as closely as possible to UK
Government Statistical Service's accessibility criteria. Relies upon the R
package 'openxlsx'. The package was developed using R 4.1.3, 'dplyr'
version 1.1.2, 'openxlsx' version 4.2.5.2, 'devtools' version 2.4.5, 'conflicted'
version 1.2.0, 'stringr' version 1.5.0, 'purrr' version 1.0.1 and 'rlang' version 1.1.0.
version 1.1.2, 'openxlsx' version 4.2.5.2, 'conflicted' version 1.2.0, 'stringr'
version 1.5.0, 'purrr' version 1.0.1 and 'rlang' version 1.1.0.
Alternative options include the R package 'a11ytables' and the
Python package 'gptables' (which can be run in R via the package 'reticulate').
URL: https://github.com/minifiemj/accessibletablesR,
Expand All @@ -21,7 +21,6 @@ Depends:
R (>= 3.5.0)
Imports:
conflicted (>= 1.2.0),
devtools (>= 2.4.5),
dplyr (>= 1.1.2),
openxlsx (>= 4.2.5.2),
purrr (>= 1.0.1),
Expand Down
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2023 minifiemj

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2023
COPYRIGHT HOLDER: Crown Copyright
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Crown Copyright

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 6 additions & 6 deletions R/creatingtables.R
Original file line number Diff line number Diff line change
Expand Up @@ -451,21 +451,21 @@ creatingtables <- function(title, subtitle = NULL, extraline1 = NULL, extraline2

for (i in seq_along(numdatacols)) {

if (!is.null(numdatacols) & class(table_data[[numdatacols[i]]]) != "character" &
class(table_data[[numdatacols[i]]]) != "numeric" &
class(table_data[[numdatacols[i]]]) != "integer") {
if (!is.null(numdatacols) & is.character(table_data[[numdatacols[i]]]) == FALSE &
is.numeric(table_data[[numdatacols[i]]]) == FALSE &
is.integer(table_data[[numdatacols[i]]]) == FALSE) {

warning(strwrap("A column identified as a number column is not of class character or numeric.
Check that is intentional.", prefix = " ", initial = ""))
othdatacols <- append(othdatacols, numdatacols[i])

} else if (class(table_data[[numdatacols[i]]]) == "character") {
} else if (is.character(table_data[[numdatacols[i]]]) == TRUE) {

numcharcols <- append(numcharcols, numdatacols[i])
numcharcolsdp <- append(numcharcolsdp, numdatacolsdp[i])

} else if (class(table_data[[numdatacols[i]]]) == "numeric" |
class(table_data[[numdatacols[i]]]) == "integer") {
} else if (is.numeric(table_data[[numdatacols[i]]]) == TRUE |
is.integer(table_data[[numdatacols[i]]]) == TRUE) {

numericcols <- append(numericcols, numdatacols[i])
numericcolsdp <- append(numericcolsdp, numdatacolsdp[i])
Expand Down
5 changes: 2 additions & 3 deletions R/workbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ workbook <- function(covertab = NULL, contentstab = NULL, notestab = NULL, auton

# Install the required packages if they are not already installed, then load the packages

listofpackages <- base::c("openxlsx", "conflicted", "devtools", "dplyr", "stringr", "purrr",
"rlang")
packageversions <- base::c("4.2.5.2", "1.2.0", "2.4.5", "1.1.2", "1.5.0", "1.0.1", "1.1.0")
listofpackages <- base::c("openxlsx", "conflicted", "dplyr", "stringr", "purrr", "rlang")
packageversions <- base::c("4.2.5.2", "1.2.0", "1.1.2", "1.5.0", "1.0.1", "1.1.0")

for (i in base::seq_along(listofpackages)) {

Expand Down
10 changes: 3 additions & 7 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ accessibletablesR is designed to produce Excel workbooks that align as closely a

[Releasing statistics in spreadsheets](https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/)

accessibletablesR was developed using R 4.1.3, dplyr version 1.1.2, openxlsx version 4.2.5.2, conflicted version 1.2.0, devtools version 2.4.5, stringr version 1.5.0, purrr version 1.0.1 and
rlang version 1.1.0. It is unknown if the package will work with earlier versions of R, dplyr, openxlsx, conflicted, devtools, stringr and purrr. accessibletablesR will install the latest versions of dplyr, openxlsx, conflicted, devtools, stringr and purrr if these packages are not currently installed or if earlier versions of dplyr (<1.1.2), openxlsx (<4.2.5.2), conflicted (<1.2.0), devtools (<2.4.5), stringr (<1.5.0), purrr (<1.0.1) and rlang (<1.1.0) are currently installed.
accessibletablesR was developed using R 4.1.3, dplyr version 1.1.2, openxlsx version 4.2.5.2, conflicted version 1.2.0, stringr version 1.5.0, purrr version 1.0.1 and rlang version 1.1.0. It is unknown if the package will work with earlier versions of R, dplyr, openxlsx, conflicted, stringr and purrr. accessibletablesR will install the latest versions of dplyr, openxlsx, conflicted, stringr and purrr if these packages are not currently installed or if earlier versions of dplyr (<1.1.2), openxlsx (<4.2.5.2), conflicted (<1.2.0), stringr (<1.5.0), purrr (<1.0.1) and rlang (<1.1.0) are currently installed.

## Installation

Expand All @@ -92,9 +91,7 @@ if (!("devtools" %in% utils::installed.packages()))
devtools::install_github("minifiemj/accessibletablesR", build_vignettes = TRUE)
```

If a firewall prevents install_github from working (a time out message may appear) then install the package manually. On the GitHub repo, go to the green "Code" icon and choose "Download ZIP". Copy
the ZIP folder to a network drive. Use devtools::install_local(<link to the zipped folder>) to
install the package.
If a firewall prevents install_github from working (a time out message may appear) then install the package manually. On the GitHub repo, go to the green "Code" icon and choose "Download ZIP". Copy the ZIP folder to a network drive. Use devtools::install_local(<link to the zipped folder>) to install the package.

## Final output

Expand Down Expand Up @@ -152,8 +149,7 @@ title is the title of the table that will be displayed in the Excel workbook tab
name of the tab wanted for the Excel workbook. table_data is the dataframe in the R global
environment to be outputted.

As well as a title, it is possible to include a subtitle and six additional lines above the table in the final Excel workbook tab. Populate the parameters subtitle, extraline1, extraline2, extraline3, extraline4, extraline5 and extraline6 if a subtitle and/or extra lines are wanted. If a link to the contents page or notes page or definitions page is desired, then set one of the extraline parameters
to "Link to contents" or "Link to notes" or "Link to definitions". The extraline parameters can be supplied as vectors and so there is no maximum limit to the number of rows that can come before the main data other than the limit of rows in an Excel spreadsheet.
As well as a title, it is possible to include a subtitle and six additional lines above the table in the final Excel workbook tab. Populate the parameters subtitle, extraline1, extraline2, extraline3, extraline4, extraline5 and extraline6 if a subtitle and/or extra lines are wanted. If a link to the contents page or notes page or definitions page is desired, then set one of the extraline parameters to "Link to contents" or "Link to notes" or "Link to definitions". The extraline parameters can be supplied as vectors and so there is no maximum limit to the number of rows that can come before the main data other than the limit of rows in an Excel spreadsheet.

headrowsize adjusts the height of the row containing the table column names.

Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ recommendations for publishing statistics in spreadsheets.
spreadsheets](https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/)

accessibletablesR was developed using R 4.1.3, dplyr version 1.1.2,
openxlsx version 4.2.5.2, conflicted version 1.2.0, devtools version
2.4.5, stringr version 1.5.0, purrr version 1.0.1 and rlang version
1.1.0. It is unknown if the package will work with earlier versions of
R, dplyr, openxlsx, conflicted, devtools, stringr and purrr.
accessibletablesR will install the latest versions of dplyr, openxlsx,
conflicted, devtools, stringr and purrr if these packages are not
currently installed or if earlier versions of dplyr (\<1.1.2), openxlsx
(\<4.2.5.2), conflicted (\<1.2.0), devtools (\<2.4.5), stringr
openxlsx version 4.2.5.2, conflicted version 1.2.0, stringr version
1.5.0, purrr version 1.0.1 and rlang version 1.1.0. It is unknown if the
package will work with earlier versions of R, dplyr, openxlsx,
conflicted, stringr and purrr. accessibletablesR will install the latest
versions of dplyr, openxlsx, conflicted, stringr and purrr if these
packages are not currently installed or if earlier versions of dplyr
(\<1.1.2), openxlsx (\<4.2.5.2), conflicted (\<1.2.0), stringr
(\<1.5.0), purrr (\<1.0.1) and rlang (\<1.1.0) are currently installed.

## Installation
Expand Down
2 changes: 1 addition & 1 deletion man/accessibletablesR-package.Rd

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

2 changes: 1 addition & 1 deletion vignettes/accessibletablesR.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ accessibletablesR is designed to produce Excel workbooks that align as closely a
<br>
[Releasing statistics in spreadsheets](https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/)
<br>
accessibletablesR was developed using R 4.1.3, dplyr version 1.1.2, openxlsx version 4.2.5.2, conflicted version 1.2.0, devtools version 2.4.5, stringr version 1.5.0, purrr version 1.0.1 and rlang version 1.1.0. It is unknown if the package will work with earlier versions of R, dplyr, openxlsx, conflicted, devtools, stringr and purrr. accessibletablesR will install the latest versions of dplyr, openxlsx, conflicted, devtools, stringr and purrr if these packages are not currently installed or if earlier versions of dplyr (<1.1.2), openxlsx (<4.2.5.2), conflicted (<1.2.0), devtools (<2.4.5), stringr (<1.5.0), purrr (<1.0.1) and rlang (<1.1.0) are currently installed.
accessibletablesR was developed using R 4.1.3, dplyr version 1.1.2, openxlsx version 4.2.5.2, conflicted version 1.2.0, stringr version 1.5.0, purrr version 1.0.1 and rlang version 1.1.0. It is unknown if the package will work with earlier versions of R, dplyr, openxlsx, conflicted, stringr and purrr. accessibletablesR will install the latest versions of dplyr, openxlsx, conflicted, stringr and purrr if these packages are not currently installed or if earlier versions of dplyr (<1.1.2), openxlsx (<4.2.5.2), conflicted (<1.2.0), stringr (<1.5.0), purrr (<1.0.1) and rlang (<1.1.0) are currently installed.

## Installation

Expand Down

0 comments on commit f388ded

Please sign in to comment.