Skip to content

Commit

Permalink
tryCatch spelling error
Browse files Browse the repository at this point in the history
  • Loading branch information
kygoffe committed Oct 25, 2023
1 parent a385e35 commit 7ac33f9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 23 deletions.
4 changes: 2 additions & 2 deletions R/utils_charts.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ gpg_trend <- function(x,

gpg_pyramid <- function(x, xvar = "afc_band", yvar, yaxis_title) {
out <- tryCatch(
exp = {
expr = {
data <- x
# Create chart object
plt <- data |>
Expand Down Expand Up @@ -194,7 +194,7 @@ gpg_pyramid <- function(x, xvar = "afc_band", yvar, yaxis_title) {

gpg_stack <- function(x, xvar, yvar, groupvar, yaxis_title) {
out <- tryCatch(
exp = {
expr = {
data <- x
# Create chart object
plt <- data |>
Expand Down
16 changes: 9 additions & 7 deletions man/gpg_data.Rd

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

7 changes: 4 additions & 3 deletions man/paygap.Rd

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

2 changes: 1 addition & 1 deletion man/quartile.Rd

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

28 changes: 18 additions & 10 deletions tests/testthat/test-utils_charts.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(tidyr)
library(dplyr)

df <- gpg_data(afc_staff)
df <- gpg_data(nhsbsaGPG::afc_staff)
x <- df$df_hdcnt_gender |>
tidyr::pivot_wider(
names_from = gender,
Expand All @@ -11,8 +11,8 @@ x <- df$df_hdcnt_gender |>

y <- nhsbsaGPG::paygap

z <- df$df_hdcnt_afc |>
filter(period == "2021/22") |>
z <- df$df_hdcnt_afc |>

Check warning on line 14 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=14,col=24,[trailing_whitespace_linter] Trailing whitespace is superfluous.
filter(period == '2021/22') |>

Check warning on line 15 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=15,col=20,[quotes_linter] Only use double-quotes.

Check warning on line 15 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=15,col=33,[trailing_whitespace_linter] Trailing whitespace is superfluous.
mutate(headcount = headcount * ifelse(gender == "Male", 1, -1))

testthat::test_that("gpg_trend function runs without errors", {
Expand Down Expand Up @@ -47,8 +47,8 @@ testthat::test_that("gpg_trend takes list as an input", {

testthat::test_that("gpg_trend input data frame must contain Female,
Male column", {
expect_equal(length(grep("Female|Male", names(x))), 2)
})
expect_equal(length(grep("Female|Male", names(x))), 2)

Check warning on line 50 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=50,col=2,[indentation_linter] Indentation should be 22 spaces but is 2 spaces.
})


testthat::test_that("gpg_trend input data frame must contain period column", {
Expand All @@ -69,14 +69,22 @@ testthat::test_that("gpg_trend function runs with paygap dataframe", {


testthat::test_that("gpg_pyramid function runs without error", {
expect_silent(gpg_pyramid(z, xvar = "afc_band", yvar = "headcount",
yaxis_title = "Headcount"
expect_silent(gpg_pyramid(z ,

Check warning on line 72 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=72,col=30,[commas_linter] Commas should never have a space before.
xvar = "afc_band",

Check warning on line 73 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=73,col=26,[indentation_linter] Indentation should be 4 spaces but is 26 spaces.
yvar = "headcount",
yaxis_title = "Headcount"
))
})

testthat::test_that("gpg_stack function runs without error", {
expect_silent(gpg_stack(quartile |> filter(period == "2021/22"),
xvar = "quartile", yvar = "percent", groupvar = "ender",
yaxis_title = "Males and females in pay quartile"
expect_silent(gpg_stack(quartile |> filter(period == "2021/22") ,

Check warning on line 80 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=80,col=66,[commas_linter] Commas should never have a space before.
xvar = "quartile",

Check warning on line 81 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=81,col=28,[indentation_linter] Indentation should be 4 spaces but is 28 spaces.
yvar = "percent",
groupvar = "gender",
yaxis_title = "Males and females in pay quartile"
))
})

Check warning on line 87 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=87,col=1,[trailing_blank_lines_linter] Trailing blank lines are superfluous.

Check warning on line 88 in tests/testthat/test-utils_charts.R

View workflow job for this annotation

GitHub Actions / lint

file=tests/testthat/test-utils_charts.R,line=88,col=1,[trailing_blank_lines_linter] Trailing blank lines are superfluous.


0 comments on commit 7ac33f9

Please sign in to comment.