Skip to content

Commit

Permalink
Use package 'rutils' in place of 'gutils'
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvartan committed Sep 26, 2023
1 parent b5864d3 commit 766b0ec
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 92 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/lint.yaml

This file was deleted.

55 changes: 29 additions & 26 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -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/
# -----------------------------------------------------------

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/assign_date.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 |>
Expand Down
2 changes: 1 addition & 1 deletion R/change_date.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions R/flat_posixt.R
Original file line number Diff line number Diff line change
@@ -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())
Expand All @@ -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() |>
Expand Down
2 changes: 1 addition & 1 deletion R/int_mean.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/int_overlap.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion R/link_to_timeline.R
Original file line number Diff line number Diff line change
@@ -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")
)

Expand Down
6 changes: 3 additions & 3 deletions R/shorter_interval.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 |>
Expand All @@ -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())
Expand All @@ -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 ",
Expand Down
2 changes: 1 addition & 1 deletion R/sum_time.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}

Expand Down
28 changes: 14 additions & 14 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -125,7 +125,7 @@
"@type": "SoftwareApplication",
"identifier": "stats",
"name": "stats",
"version": ">= 4.1.0"
"version": ">= 4.2.0"
},
{
"@type": "SoftwareApplication",
Expand All @@ -146,7 +146,7 @@
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 4.1"
"version": ">= 4.2"
},
"2": {
"@type": "SoftwareApplication",
Expand Down Expand Up @@ -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",
Expand All @@ -206,7 +200,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=hms"
},
"7": {
"6": {
"@type": "SoftwareApplication",
"identifier": "lifecycle",
"name": "lifecycle",
Expand All @@ -219,7 +213,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=lifecycle"
},
"8": {
"7": {
"@type": "SoftwareApplication",
"identifier": "lubridate",
"name": "lubridate",
Expand All @@ -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",
Expand All @@ -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"]
}
2 changes: 1 addition & 1 deletion tests/testthat/test-link_to_timeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading

0 comments on commit 766b0ec

Please sign in to comment.