From 2fb2ac80e05e2c288127be67f7285ca3beefbd15 Mon Sep 17 00:00:00 2001 From: Daniel Vartanian Date: Tue, 26 Sep 2023 01:25:30 -0300 Subject: [PATCH] Use package 'rutils' in place of 'gutils' --- .github/workflows/lint.yaml | 32 -------------------------------- .gitignore | 1 + DESCRIPTION | 12 ++++++------ R/read_acttrust.R | 8 ++++---- R/write_acttrust.R | 6 +++++- actverse.Rproj | 2 +- 6 files changed, 17 insertions(+), 44 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/.gitignore b/.gitignore index 31276bf..83dea49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +# See https://git-scm.com/docs/gitignore # Created by https://www.toptal.com/developers/gitignore/api/r # Edit at https://www.toptal.com/developers/gitignore?templates=r diff --git a/DESCRIPTION b/DESCRIPTION index d238300..26058fa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -49,20 +49,20 @@ License: MIT + file LICENSE URL: https://giperbio.github.io/actverse/, https://github.com/giperbio/actverse/ BugReports: https://github.com/giperbio/actverse/issues Depends: - R (>= 4.1) + R (>= 4.2) Imports: checkmate (>= 2.1.0), cli (>= 3.6.0), dplyr (>= 1.1.0), ggplot2 (>= 3.4.1), - gutils, hms (>= 1.1.2), lifecycle (>= 1.0.3), lubridate (>= 1.9.2), magrittr (>= 2.0.3), purrr (>= 1.0.1), rlang (>= 1.0.6), - stats (>= 4.1.0), + rutils, + stats (>= 4.2.0), tsibble (>= 1.1.3), viridis (>= 0.6.2) Suggests: @@ -79,11 +79,11 @@ Suggests: suncalc (>= 0.5.1), testthat (>= 3.1.6), tibble (>= 3.1.8), - tools (>= 4.1.0), - utils (>= 4.1.0), + tools (>= 4.2.0), + utils (>= 4.2.0), zoo (>= 1.8-11) Remotes: - github::giperbio/gutils + github::danielvartan/rutils VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/R/read_acttrust.R b/R/read_acttrust.R index 3314b11..14f0c77 100644 --- a/R/read_acttrust.R +++ b/R/read_acttrust.R @@ -239,7 +239,7 @@ validate_acttrust_data <- function(data, regularize = TRUE) { out <- out %>% dplyr::mutate(dplyr::across( !dplyr::matches("^timestamp$|^state$"), - ~ dplyr::if_else(state == 4, gutils::na_as(.x), .x))) + ~ dplyr::if_else(state == 4, rutils::na_as(.x), .x))) offwrist_ints <- find_offwrist_intervals(out) @@ -258,11 +258,11 @@ validate_acttrust_data <- function(data, regularize = TRUE) { )) %>% dplyr::mutate(dplyr::across( !dplyr::matches("^timestamp$|^orientation$"), - ~ dplyr::if_else(.x < 0, gutils::na_as(.x), .x) + ~ dplyr::if_else(.x < 0, rutils::na_as(.x), .x) )) %>% dplyr::mutate(dplyr::across( dplyr::ends_with("_temperature"), - ~ dplyr::if_else(.x >= 100, gutils::na_as(.x), .x) + ~ dplyr::if_else(.x >= 100, rutils::na_as(.x), .x) )) } @@ -295,7 +295,7 @@ regularize_acttrust_data <- function(data) { aggregate_index(epoch_unit) %>% dplyr::mutate(dplyr::across( !dplyr::matches("^timestamp$"), - ~ dplyr::if_else(is.nan(.x), gutils::na_as(.x), .x) + ~ dplyr::if_else(is.nan(.x), rutils::na_as(.x), .x) )) count_gaps <- tsibble::count_gaps(out) %>% diff --git a/R/write_acttrust.R b/R/write_acttrust.R index 542d019..3f7ff72 100644 --- a/R/write_acttrust.R +++ b/R/write_acttrust.R @@ -65,7 +65,7 @@ write_acttrust <- function(data, file, delim = ";", header = NULL) { # R CMD Check variable bindings fix (see: https://bit.ly/3z24hbU) # nolint start: object_usage_linter. - acttrust <- acttrust + acttrust <- NULL . <- NULL timestamp <- date <- time <- ms <- NULL pim <- pim_n <- tat <- tat_n <- zcm <- zcm_n <- NULL @@ -75,6 +75,10 @@ write_acttrust <- function(data, file, delim = ";", header = NULL) { event <- state <- NULL # nolint end + utils::data( + "acttrust", package = "actverse", envir = environment() + ) + epoch <- find_epoch(data)$best_match cols <- paste0("^timestamp$|^", tsibble::index2_var(data), "$") %>% grep(names(acttrust), value = TRUE, invert = TRUE) diff --git a/actverse.Rproj b/actverse.Rproj index bfa3107..cba1b6b 100644 --- a/actverse.Rproj +++ b/actverse.Rproj @@ -6,7 +6,7 @@ AlwaysSaveHistory: Default EnableCodeIndexing: Yes UseSpacesForTab: Yes -NumSpacesForTab: 4 +NumSpacesForTab: 2 Encoding: UTF-8 RnwWeave: Sweave