Skip to content

Commit

Permalink
Address linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkucharski committed Jul 2, 2024
1 parent e79f954 commit fa4129f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions R/estimate_severity.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' the estimate and confidence intervals cannot be calculated and the output
#' `<data.frame>` contains only `NA`s.
#'
#' - When `total_outcomes <= total_deaths`, the estimate and confidence intervals
#' - When `total_outcomes <= total_deaths`, estimate and confidence intervals
#' cannot be reliably calculated and are returned as `NA`.
.estimate_severity <- function(total_cases,
total_deaths,
Expand Down Expand Up @@ -64,16 +64,17 @@
pprange <- seq(from = 1e-4, to = 1.0, by = 1e-4)

# if more expected outcomes than observed deaths, set outcomes equal to deaths
if (total_outcomes >= total_deaths){
total_outcomes_checked <- total_outcomes }else{
if (total_outcomes >= total_deaths){

Check warning on line 67 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=67,col=38,[brace_linter] There should be a space before an opening curly brace.

Check warning on line 67 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=67,col=38,[paren_body_linter] There should be a space between a right parenthesis and a body expression.

Check warning on line 67 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=67,col=39,[trailing_whitespace_linter] Trailing whitespace is superfluous.
total_outcomes_checked <- total_outcomes
}else{

Check warning on line 69 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=69,col=12,[brace_linter] There should be a space before an opening curly brace.

Check warning on line 69 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=69,col=13,[trailing_whitespace_linter] Trailing whitespace is superfluous.
total_outcomes_checked <- NA
message(
"Total deaths = ", total_deaths,
" and expected outcomes = ", round(total_outcomes),
" so setting expected outcomes = NA. If we were to assume
total deaths = expected outcomes, it would produce an estimate of 1."
)
}
}

Check warning on line 78 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=78,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
# get likelihoods using selected function
lik <- func_likelihood(total_outcomes_checked, total_deaths, pprange)
Expand All @@ -83,9 +84,11 @@
severity_estimate <- pprange[which.max(lik)]
if (length(severity_estimate)==0){

Check warning on line 85 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=85,col=32,[infix_spaces_linter] Put spaces around all infix operators.

Check warning on line 85 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=85,col=36,[brace_linter] There should be a space before an opening curly brace.

Check warning on line 85 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=85,col=36,[paren_body_linter] There should be a space between a right parenthesis and a body expression.
severity_estimate <- NA
severity_lims <- c(NA,NA) }else{
severity_lims <- c(NA, NA)
}else{

Check warning on line 88 in R/estimate_severity.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/estimate_severity.R,line=88,col=10,[brace_linter] There should be a space before an opening curly brace.
severity_lims <- range(pprange[lik >=
(max(lik,na.rm = TRUE) - 1.92)],na.rm = TRUE)
(max(lik, na.rm = TRUE) - 1.92)],
na.rm = TRUE)
}

# return a vector for easy conversion to data
Expand Down

0 comments on commit fa4129f

Please sign in to comment.