ci: replace Jenkins with Gitea Actions, modernize DESCRIPTION
R-CMD-check / R CMD check (push) Failing after 3s
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:
@@ -234,14 +234,21 @@ outersect <- function(x, y, ...) {
|
||||
#' @param stabbr a two letter abbreviation for a US state
|
||||
#'
|
||||
#' @return FIPS codes that match the abbreviation
|
||||
#' @import tidycensus
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' get_fips("MT")
|
||||
#' get_fips("PR")
|
||||
#' get_fips("CC")
|
||||
#' }
|
||||
get_fips <- function(stabbr) {
|
||||
if (!requireNamespace("tidycensus", quietly = TRUE)) {
|
||||
stop(
|
||||
"Package 'tidycensus' is required for get_fips(). ",
|
||||
"Install it with: install.packages('tidycensus')",
|
||||
call. = FALSE
|
||||
)
|
||||
}
|
||||
fips <- tidycensus::fips_codes[, 1:2]
|
||||
fips <- fips[!duplicated(fips),]
|
||||
out <- fips[fips$state == stabbr, 2]
|
||||
@@ -253,12 +260,20 @@ get_fips <- function(stabbr) {
|
||||
#' @param fips a character value that captures the FIPS code with leading 0
|
||||
#'
|
||||
#' @return a character value, length 2, with the state abbreviation
|
||||
#' @import tidycensus
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' get_stabbr("06")
|
||||
#' }
|
||||
get_stabbr <- function(fips) {
|
||||
if (!requireNamespace("tidycensus", quietly = TRUE)) {
|
||||
stop(
|
||||
"Package 'tidycensus' is required for get_stabbr(). ",
|
||||
"Install it with: install.packages('tidycensus')",
|
||||
call. = FALSE
|
||||
)
|
||||
}
|
||||
fips_codes <- tidycensus::fips_codes[, 1:2]
|
||||
fips_codes <- fips_codes[!duplicated(fips_codes),]
|
||||
if (length(fips) != 1) {
|
||||
@@ -442,6 +457,6 @@ round_to_nearest_half <- function(x) {
|
||||
#' @examples
|
||||
#' rnh(c(0.2, 0.3, 0.4, 0.8, 0.09, 0.9))
|
||||
rnh <- function(x) {
|
||||
tmp <- Vectorize(civilytics::round_to_nearest_half)
|
||||
tmp <- Vectorize(round_to_nearest_half)
|
||||
tmp(x)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user