From 766b0ec48a4ed047a4bcf195c8d183b822661d31 Mon Sep 17 00:00:00 2001 From: Daniel Vartanian Date: Tue, 26 Sep 2023 01:52:35 -0300 Subject: [PATCH] Use package 'rutils' in place of 'gutils' --- .github/workflows/lint.yaml | 32 --------------- CITATION.cff | 55 ++++++++++++++------------ DESCRIPTION | 6 +-- R/assign_date.R | 2 +- R/change_date.R | 2 +- R/flat_posixt.R | 8 ++-- R/int_mean.R | 2 +- R/int_overlap.R | 2 +- R/link_to_timeline.R | 2 +- R/shorter_interval.R | 6 +-- R/sum_time.R | 2 +- codemeta.json | 28 ++++++------- tests/testthat/test-link_to_timeline.R | 2 +- tests/testthat/test-shorter_interval.R | 6 +-- 14 files changed, 63 insertions(+), 92 deletions(-) delete mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 9bc3d96..0000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - -name: lint - -jobs: - lint: - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::lintr, local::. - needs: lint - - - name: Lint - run: lintr::lint_package() - shell: Rscript {0} - env: - LINTR_ERROR_ON_LINT: true \ No newline at end of file diff --git a/CITATION.cff b/CITATION.cff index dd1ad89..966f9d5 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,5 +1,5 @@ # ----------------------------------------------------------- -# CITATION file created with {cffr} R package, v0.4.1 +# CITATION file created with {cffr} R package, v0.5.0 # See also: https://docs.ropensci.org/cffr/ # ----------------------------------------------------------- @@ -46,7 +46,7 @@ references: year: '2023' institution: name: R Foundation for Statistical Computing - version: '>= 4.1' + version: '>= 4.2' - type: software title: checkmate abstract: 'checkmate: Fast and Versatile Argument Checks' @@ -97,17 +97,6 @@ references: orcid: https://orcid.org/0000-0003-4777-038X year: '2023' version: '>= 1.1.0' -- type: software - title: gutils - abstract: 'gutils: Utility Functions Created by the GIPERBIO Developer Team' - notes: Imports - url: https://giperbio.github.io/gutils/ - authors: - - family-names: Vartanian - given-names: Daniel - email: danvartan@gmail.com - orcid: https://orcid.org/0000-0001-7782-759X - year: '2023' - type: software title: hms abstract: 'hms: Pretty Time of Day' @@ -153,6 +142,17 @@ references: given-names: Hadley year: '2023' version: '>= 1.9.2' +- type: software + title: rutils + abstract: 'rutils: Utility Functions for R' + notes: Imports + url: https://danielvartan.github.io/rutils/ + authors: + - family-names: Vartanian + given-names: Daniel + email: danvartan@gmail.com + orcid: https://orcid.org/0000-0001-7782-759X + year: '2023' - type: software title: covr abstract: 'covr: Test Coverage for Packages' @@ -199,10 +199,10 @@ references: authors: - family-names: Henry given-names: Lionel - email: lionel@rstudio.com + email: lionel@posit.co - family-names: Wickham given-names: Hadley - email: hadley@rstudio.com + email: hadley@posit.co year: '2023' version: '>= 1.0.6' - type: software @@ -214,35 +214,38 @@ references: authors: - family-names: Allaire given-names: JJ - email: jj@rstudio.com + email: jj@posit.co - family-names: Xie given-names: Yihui email: xie@yihui.name orcid: https://orcid.org/0000-0003-0645-5666 + - family-names: Dervieux + given-names: Christophe + email: cderv@posit.co + orcid: https://orcid.org/0000-0003-4474-2498 - family-names: McPherson given-names: Jonathan - email: jonathan@rstudio.com + email: jonathan@posit.co - family-names: Luraschi given-names: Javier - email: javier@rstudio.com - family-names: Ushey given-names: Kevin - email: kevin@rstudio.com + email: kevin@posit.co - family-names: Atkins given-names: Aron - email: aron@rstudio.com + email: aron@posit.co - family-names: Wickham given-names: Hadley - email: hadley@rstudio.com + email: hadley@posit.co - family-names: Cheng given-names: Joe - email: joe@rstudio.com + email: joe@posit.co - family-names: Chang given-names: Winston - email: winston@rstudio.com + email: winston@posit.co - family-names: Iannone given-names: Richard - email: rich@rstudio.com + email: rich@posit.co orcid: https://orcid.org/0000-0003-3925-190X year: '2023' version: '>= 2.20' @@ -273,7 +276,7 @@ references: year: '2023' institution: name: R Foundation for Statistical Computing - version: '>= 4.1.0' + version: '>= 4.2.0' - type: software title: testthat abstract: 'testthat: Unit Testing for R' @@ -283,7 +286,7 @@ references: authors: - family-names: Wickham given-names: Hadley - email: hadley@rstudio.com + email: hadley@posit.co year: '2023' version: '>= 3.1.6' identifiers: diff --git a/DESCRIPTION b/DESCRIPTION index 3a73df4..e71de76 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,10 +22,10 @@ Imports: checkmate (>= 2.1.0), cli (>= 3.6.0), dplyr (>= 1.1.0), - gutils, hms (>= 1.1.2), lifecycle (>= 1.0.3), - lubridate (>= 1.9.2) + lubridate (>= 1.9.2), + rutils Suggests: covr (>= 3.6.1), knitr (>= 1.42), @@ -36,7 +36,7 @@ Suggests: stats (>= 4.2.0), testthat (>= 3.1.6) Remotes: - github::giperbio/gutils + github::danielvartan/rutils VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/R/assign_date.R b/R/assign_date.R index 77d683a..b41901f 100644 --- a/R/assign_date.R +++ b/R/assign_date.R @@ -109,7 +109,7 @@ assign_date <- function(start, end, ambiguity = 0) { checkmate::assert_multi_class(end, c("hms", "POSIXt")) checkmate::assert_numeric(as.numeric(hms::as_hms(end)), lower = 0, upper = 86400) - gutils:::assert_identical(start, end, type = "length") + rutils:::assert_identical(start, end, type = "length") checkmate::assert_choice(ambiguity, c(0, 24, NA)) start <- start |> diff --git a/R/change_date.R b/R/change_date.R index 03aac61..5a7f933 100644 --- a/R/change_date.R +++ b/R/change_date.R @@ -4,7 +4,7 @@ change_date <- function(x, date) { classes <- c("character", "Date") checkmate::assert_multi_class(date, classes) - gutils:::assert_length_one(date) + rutils:::assert_length_one(date) lubridate::date(x) <- date diff --git a/R/flat_posixt.R b/R/flat_posixt.R index 3435e3b..3a0cf15 100644 --- a/R/flat_posixt.R +++ b/R/flat_posixt.R @@ -1,6 +1,6 @@ flat_posixt <- function(posixt, base = as.Date("1970-01-01"), force_tz = TRUE, tz = "UTC") { - gutils:::assert_posixt(posixt, null.ok = FALSE) + rutils:::assert_posixt(posixt, null.ok = FALSE) checkmate::assert_date(base, len = 1, all.missing = FALSE) checkmate::assert_flag(force_tz) checkmate::assert_choice(tz, OlsonNames()) @@ -15,15 +15,15 @@ flat_posixt <- function(posixt, base = as.Date("1970-01-01"), } flat_posixt_date <- function(posixt, base = as.Date("1970-01-01")) { - gutils:::assert_posixt(posixt, null.ok = FALSE) + rutils:::assert_posixt(posixt, null.ok = FALSE) checkmate::assert_date(base, len = 1, any.missing = FALSE) posixt |> lubridate::`date<-`(base) |> c() } flat_posixt_hour <- function(posixt, base = hms::parse_hms("00:00:00")) { - gutils:::assert_posixt(posixt) - gutils:::assert_hms(base, any.missing = FALSE) + rutils:::assert_posixt(posixt) + rutils:::assert_hms(base, any.missing = FALSE) posixt |> lubridate::date() |> diff --git a/R/int_mean.R b/R/int_mean.R index 619643f..aeaa3fd 100644 --- a/R/int_mean.R +++ b/R/int_mean.R @@ -9,7 +9,7 @@ int_mean <- function(start, end, ambiguity = 24) { cycle = lubridate::ddays()) end <- cycle_time(hms::hms(extract_seconds(end)), cycle = lubridate::ddays()) - interval <- gutils:::shush(assign_date(start, end, ambiguity = ambiguity)) + interval <- rutils:::shush(assign_date(start, end, ambiguity = ambiguity)) mean <- as.numeric(start) + (as.numeric(interval) / 2) hms::hms(mean) diff --git a/R/int_overlap.R b/R/int_overlap.R index 347d206..b384775 100644 --- a/R/int_overlap.R +++ b/R/int_overlap.R @@ -31,7 +31,7 @@ int_overlap <- function(int_1, int_2) { get_int_overlap <- function(int_1, int_2) { if (isFALSE(lubridate::int_overlaps(int_1, int_2))) { - return(gutils::na_as(int_1)) + return(rutils::na_as(int_1)) } else { int_start <- dplyr::if_else( lubridate::int_start(int_1) >= lubridate::int_start(int_2), diff --git a/R/link_to_timeline.R b/R/link_to_timeline.R index 31da632..a79c42f 100644 --- a/R/link_to_timeline.R +++ b/R/link_to_timeline.R @@ -1,6 +1,6 @@ link_to_timeline <- function(x, threshold = hms::parse_hms("12:00:00")) { checkmate::assert_multi_class(x, c("hms", "POSIXt")) - gutils:::assert_hms( + rutils:::assert_hms( threshold, lower = hms::hms(0), upper = hms::parse_hms("23:59:59") ) diff --git a/R/shorter_interval.R b/R/shorter_interval.R index ebc1a28..0f88c16 100644 --- a/R/shorter_interval.R +++ b/R/shorter_interval.R @@ -182,7 +182,7 @@ int_build <- function(x, y, method = "shorter") { checkmate::assert_multi_class(y, c("hms", "POSIXt")) checkmate::assert_numeric(as.numeric(hms::as_hms(y)), lower = 0, upper = 86400) - gutils:::assert_identical(x, y, type = "length") + rutils:::assert_identical(x, y, type = "length") checkmate::assert_choice(method, method_choices) x <- x |> @@ -195,7 +195,7 @@ int_build <- function(x, y, method = "shorter") { as.POSIXct() |> flat_posixt() - list2env(gutils:::swap(x, y, x > y), envir = environment()) + list2env(rutils:::swap(x, y, x > y), envir = environment()) x1_y1_interval <- lubridate::interval(x, y) y1_x2_interval <- lubridate::interval(y, x + lubridate::days()) @@ -220,7 +220,7 @@ int_build <- function(x, y, method = "shorter") { flags <- which(x1_y1_interval == y1_x2_interval) # nolint cli::cli_alert_warning(paste0( - "Element{?s} {gutils:::single_quote_(as.character(flags))} of 'x' ", + "Element{?s} {rutils:::single_quote_(as.character(flags))} of 'x' ", "and 'y' have intervals equal to 12 hours, i.e., ", "there's no shorter or longer interval ", "between the two hours (they are equal). Only one ", diff --git a/R/sum_time.R b/R/sum_time.R index f57df43..ad98350 100644 --- a/R/sum_time.R +++ b/R/sum_time.R @@ -295,7 +295,7 @@ sum_time_build <- function(..., vectorize = FALSE, cycle = NULL, checkmate::assert_flag(na_rm) if (isTRUE(vectorize) && - !(length(unique(vapply(out, length, integer(1)))) == 1)) { #nolint + !(length(unique(vapply(out, length, integer(1)))) == 1)) { # nolint cli::cli_abort("All values in '...' must have the same length.") } diff --git a/codemeta.json b/codemeta.json index 0abff7f..3a6d9c4 100644 --- a/codemeta.json +++ b/codemeta.json @@ -14,7 +14,7 @@ "name": "R", "url": "https://r-project.org" }, - "runtimePlatform": "R version 4.2.2 (2022-10-31 ucrt)", + "runtimePlatform": "R version 4.3.1 (2023-06-16 ucrt)", "author": [ { "@type": "Person", @@ -125,7 +125,7 @@ "@type": "SoftwareApplication", "identifier": "stats", "name": "stats", - "version": ">= 4.1.0" + "version": ">= 4.2.0" }, { "@type": "SoftwareApplication", @@ -146,7 +146,7 @@ "@type": "SoftwareApplication", "identifier": "R", "name": "R", - "version": ">= 4.1" + "version": ">= 4.2" }, "2": { "@type": "SoftwareApplication", @@ -188,12 +188,6 @@ "sameAs": "https://CRAN.R-project.org/package=dplyr" }, "5": { - "@type": "SoftwareApplication", - "identifier": "gutils", - "name": "gutils", - "sameAs": "https://github.com/giperbio/gutils" - }, - "6": { "@type": "SoftwareApplication", "identifier": "hms", "name": "hms", @@ -206,7 +200,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=hms" }, - "7": { + "6": { "@type": "SoftwareApplication", "identifier": "lifecycle", "name": "lifecycle", @@ -219,7 +213,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=lifecycle" }, - "8": { + "7": { "@type": "SoftwareApplication", "identifier": "lubridate", "name": "lubridate", @@ -232,9 +226,15 @@ }, "sameAs": "https://CRAN.R-project.org/package=lubridate" }, + "8": { + "@type": "SoftwareApplication", + "identifier": "rutils", + "name": "rutils", + "sameAs": "https://github.com/danielvartan/rutils" + }, "SystemRequirements": null }, - "fileSize": "130.406KB", + "fileSize": "128.883KB", "citation": [ { "@type": "CreativeWork", @@ -254,8 +254,8 @@ } ], "releaseNotes": "https://github.com/giperbio/lubritime/blob/master/NEWS.md", - "readme": "https://github.com/giperbio/lubritime/blob/main/README.md", - "contIntegration": ["https://github.com/giperbio/lubritime/actions", "https://codecov.io/gh/giperbio/lubritime?branch=main"], + "readme": "https://github.com/danielvartan/lubritime/blob/main/README.md", + "contIntegration": ["https://github.com/giperbio/lubritime/actions", "https://app.codecov.io/gh/giperbio/lubritime?branch=main"], "developmentStatus": ["https://www.repostatus.org/#wip", "https://lifecycle.r-lib.org/articles/stages.html#experimental"], "keywords": ["r-package", "time", "r", "rstats"] } diff --git a/tests/testthat/test-link_to_timeline.R b/tests/testthat/test-link_to_timeline.R index 10eba36..42c7c5b 100644 --- a/tests/testthat/test-link_to_timeline.R +++ b/tests/testthat/test-link_to_timeline.R @@ -35,7 +35,7 @@ test_that("link_to_timeline() | error test", { ) |> expect_error("Assertion on 'x' failed") - # gutils:::assert_hms( + # rutils:::assert_hms( # threshold, lower = hms::hms(0), upper = hms::parse_hms("23:59:59") # ) link_to_timeline( diff --git a/tests/testthat/test-shorter_interval.R b/tests/testthat/test-shorter_interval.R index 12e1bb7..8b751cd 100644 --- a/tests/testthat/test-shorter_interval.R +++ b/tests/testthat/test-shorter_interval.R @@ -49,7 +49,7 @@ test_that("int_build() | vector test", { lubridate::ymd_hms("1970-01-02 04:15:00") ), lubridate::as.interval( - lubridate::ymd_hms("1970-01-01 09:00:00"), #nolint + lubridate::ymd_hms("1970-01-01 09:00:00"), # nolint lubridate::ymd_hms("1970-01-01 12:00:00")) )) }) @@ -125,7 +125,7 @@ test_that("shorter_int() | general test", { y = lubridate::parse_date_time("11:45:00", "HMS") ), lubridate::as.interval( - lubridate::ymd_hms("1970-01-01 01:10:00"), #nolint + lubridate::ymd_hms("1970-01-01 01:10:00"), # nolint lubridate::ymd_hms("1970-01-01 11:45:00")) ) @@ -157,7 +157,7 @@ test_that("longer_int() | general test", { y = lubridate::parse_date_time("11:45:00", "HMS") ), lubridate::as.interval( - lubridate::ymd_hms("1970-01-01 11:45:00"), #nolint + lubridate::ymd_hms("1970-01-01 11:45:00"), # nolint lubridate::ymd_hms("1970-01-02 01:10:00")) )