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

Fix some R CMD CHK build error and warnings #743

Merged
merged 5 commits into from
Jul 17, 2023
Merged
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
4 changes: 4 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ itle
iwalk
jaccard
jan
jennifer
jul
keydate
keyring
Expand All @@ -104,6 +105,8 @@ ltc
ltcs
lubridate
magrittr
Mcbride
mcmahon
MMMYY
monthflag
mpat
Expand Down Expand Up @@ -200,5 +203,6 @@ xintercept
xlsx
yearstay
YYYYQX
zihao
zsav
zstd
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Imports:
dtplyr (>= 1.3.0),
fs (>= 1.6.1),
fst (>= 0.9.8),
future (>= 1.33.0),
future.callr (>= 0.8.1),
glue (>= 1.6.2),
haven (>= 2.5.2),
hms (>= 1.1.0),
Expand Down
4 changes: 2 additions & 2 deletions R/produce_test_comparison.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ produce_test_comparison <- function(old_data, new_data, recid = FALSE) {
dplyr::mutate(
difference = round(.data$value_new - .data$value_old, digits = 2L),
pct_change = .data$difference / .data$value_old,
issue = !dplyr::between(pct_change, -0.05, 0.05)
issue = !dplyr::between(.data$pct_change, -0.05, 0.05)
)
} else {
dplyr::full_join(old_data,
Expand All @@ -34,7 +34,7 @@ produce_test_comparison <- function(old_data, new_data, recid = FALSE) {
dplyr::mutate(
difference = round(.data$value_new - .data$value_old, digits = 2L),
pct_change = .data$difference / .data$value_old,
issue = !dplyr::between(pct_change, -0.05, 0.05)
issue = !dplyr::between(.data$pct_change, -0.05, 0.05)
)
}
}
1 change: 1 addition & 0 deletions R/run_episode_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@
fill_missing_cij_markers <- function(data) {
fixable_data <- data %>%
dplyr::filter(
.data[["recid"]] %in% c("01B", "04B", "GLS", "02B", "DD") & !is.na(.data[["chi"]])

Check warning on line 196 in R/run_episode_file.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/run_episode_file.R,line=196,col=81,[line_length_linter] Lines should not be more than 80 characters.
)

non_fixable_data <- data %>%
dplyr::filter(
!(.data[["recid"]] %in% c("01B", "04B", "GLS", "02B", "DD")) | is.na(.data[["chi"]])

Check warning on line 201 in R/run_episode_file.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/run_episode_file.R,line=201,col=81,[line_length_linter] Lines should not be more than 80 characters.
)

fixed_data <- fixable_data %>%
Expand Down Expand Up @@ -331,8 +331,8 @@
})

# This 'blocks' the code until they have both finished executing
value_demographic <- future::value(future_demographic)

Check warning on line 334 in R/run_episode_file.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/run_episode_file.R,line=334,col=3,[object_usage_linter] local variable ‘value_demographic’ assigned but may not be used
value_service_use <- future::value(future_service_use)

Check warning on line 335 in R/run_episode_file.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/run_episode_file.R,line=335,col=3,[object_usage_linter] local variable ‘value_service_use’ assigned but may not be used

return(data)
}
Expand All @@ -340,6 +340,7 @@
#' Join cohort lookups
#'
#' @inheritParams store_ep_file_vars
#' @inheritParams get_demographic_cohorts_path
#'
#' @return The data including the Demographic and Service Use lookups.
join_cohort_lookups <- function(data, year, update = latest_update()) {
Expand Down
4 changes: 2 additions & 2 deletions R/write_tests_xlsx.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@

cli::cli_progress_bar(
type = "iterator",
format = "{cli::pb_spin} [{cli::pb_elapsed}] Waiting for {tests_workbook_name}..."

Check warning on line 45 in R/write_tests_xlsx.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/write_tests_xlsx.R,line=45,col=81,[line_length_linter] Lines should not be more than 80 characters.
)
while (fs::file_exists(path = in_use_path) && seconds < max_wait) {
# While the tests are in use (wait a random number of seconds from 1 to 30)

Check warning on line 48 in R/write_tests_xlsx.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/write_tests_xlsx.R,line=48,col=81,[line_length_linter] Lines should not be more than 80 characters.
cli::cli_progress_update()
wait <- round(runif(1, 1, 15))
wait <- sample(x = 3:15, size = 1)

Sys.sleep(wait)
seconds <- seconds + wait
Expand All @@ -56,7 +56,7 @@
}

# Final check to maybe avoid corrupting the workbook
Sys.sleep(round(runif(1, 1, 3)))
Sys.sleep(sample(x = 1:3, size = 1))
if (!fs::file_exists(path = in_use_path)) {
fs::file_create(path = in_use_path)
} else {
Expand All @@ -79,7 +79,7 @@
}

# add a new sheet for tests
date_today <- format(Sys.Date(), "%d_%b")

Check warning on line 82 in R/write_tests_xlsx.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/write_tests_xlsx.R,line=82,col=3,[object_usage_linter] local variable ‘date_today’ assigned but may not be used
sheet_name_dated <- ifelse(
is.null(year),
stringr::str_glue("{sheet_name}_{date_today}"),
Expand Down Expand Up @@ -185,7 +185,7 @@
fs::file_delete(path = in_use_path)

cli::cli_alert_success(
"The tests for {year}{ifelse(is.null(year), '', '-')}{sheet_name} were written to {.file {fs::path_file(tests_workbook_path)}}"

Check warning on line 188 in R/write_tests_xlsx.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/write_tests_xlsx.R,line=188,col=81,[line_length_linter] Lines should not be more than 80 characters.
)

return(comparison_data)
Expand Down
2 changes: 2 additions & 0 deletions man/join_cohort_lookups.Rd

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

Loading