ci: replace Jenkins with Gitea Actions, modernize DESCRIPTION
R-CMD-check / R CMD check (push) Failing after 3s

- Add real R CMD check workflow via Gitea Actions (rocker/r-ver:4.4)
- Remove Jenkinsfile and demo workflow
- Modernize DESCRIPTION: Authors@R, R >= 4.1.0, URL/BugReports fields,
  move tidycensus from Imports to Suggests, testthat edition 3
- Fix agresti_coull_interval: correct implementation, export it
- Convert get_fips/get_stabbr to use requireNamespace for tidycensus
- Remove civilytics:: self-reference in rnh()
This commit is contained in:
2026-05-17 09:05:45 -06:00
parent 01c9d1c796
commit 38cdaa8ea7
8 changed files with 95 additions and 103 deletions
+16 -9
View File
@@ -72,14 +72,21 @@ waldInterval <- function(x, n, conf.level = 0.95){
#' Calculate the Agresti-Coull interval
#'
#' @param num a number of successes
#' @param den a number of trials
#' @param conf.level default 0.95, set the confidence interval to return
#' @param num number of successes
#' @param den number of trials
#' @param conf.level default 0.95, confidence level for the interval
#'
#' @return an interval
agresti_coull_interval <- function(num, den, conf.level) {
num <- num + 2
den <- den + 4
return(num/den)
#' @return three values forming the lower bound, observed proportion, and upper bound
#' @export
#'
#' @examples
#' agresti_coull_interval(20, 40)
#' agresti_coull_interval(2, 100, conf.level = 0.99)
agresti_coull_interval <- function(num, den, conf.level = 0.95) {
z <- qnorm(1 - (1 - conf.level) / 2)
n_tilde <- den + z^2
p_tilde <- (num + z^2 / 2) / n_tilde
margin <- z * sqrt(p_tilde * (1 - p_tilde) / n_tilde)
obs <- num / den
return(c("low" = p_tilde - margin, "observed" = obs, "high" = p_tilde + margin))
}