Skip to content

Commit c57598d

Browse files
authored
Merge pull request #48 from pydemull/dev
Dev
2 parents fff1b3e + 48d57cf commit c57598d

File tree

8 files changed

+63
-32
lines changed

8 files changed

+63
-32
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
R_KEEP_PKG_SOURCE: yes
2929

3030
steps:
31-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@v3
3232

3333
- uses: r-lib/actions/setup-pandoc@v2
3434

.github/workflows/pkgdown.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
- uses: r-lib/actions/setup-r@v2
1818

19-
- uses: r-lib/actions/setup-pandoc@v1
19+
- uses: r-lib/actions/setup-pandoc@v2
2020

2121
- name: Query dependencies
2222
run: |
@@ -26,7 +26,7 @@ jobs:
2626
shell: Rscript {0}
2727

2828
- name: Restore R package cache
29-
uses: actions/cache@v2
29+
uses: actions/cache@v4
3030
with:
3131
path: ${{ env.R_LIBS_USER }}
3232
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}

.github/workflows/test-coverage.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
1-
# File from: https://github.com/r-lib/actions/blob/v2/examples/test-coverage.yaml
2-
3-
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
1+
# Workflow derived from https://github.com/rstudio/shinytest2/tree/main/actions/test-app/example-test-app-description.yaml
42
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
53
on:
64
push:
75
branches: [main, master]
86
pull_request:
97
branches: [main, master]
108

11-
name: test-coverage
9+
name: Test app w/ {renv}
1210

1311
jobs:
14-
test-coverage:
15-
runs-on: ubuntu-latest
12+
test-app:
13+
runs-on: ${{ matrix.config.os }}
14+
15+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
config:
21+
- {os: ubuntu-latest, r: release}
22+
1623
env:
1724
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
25+
R_KEEP_PKG_SOURCE: yes
1826

1927
steps:
20-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v3
29+
30+
- uses: r-lib/actions/setup-pandoc@v2
2131

2232
- uses: r-lib/actions/setup-r@v2
2333
with:
34+
r-version: ${{ matrix.config.r }}
2435
use-public-rspm: true
2536

26-
- uses: r-lib/actions/setup-r-dependencies@v2
37+
- uses: r-lib/actions/setup-renv@v2
38+
39+
- uses: rstudio/shinytest2/actions/test-app@actions/v1
2740
with:
28-
extra-packages: any::covr
29-
needs: coverage
41+
app-dir: "."
3042

3143
- name: Test coverage
3244
run: covr::codecov(quiet = FALSE, clean = FALSE)

DESCRIPTION

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ Suggests:
6060
tibble,
6161
rlang,
6262
tinytex,
63-
shinytest2
63+
shinytest2,
64+
pkgdown,
65+
callr
6466
Language: en-US
6567
Depends: R (>= 3.4.0)
6668
Config/testthat/edition: 3

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# activAnalyzer (development version)
2+
* When collapsing data from a shorter epoch to a longer epoch, NAs are introduced in the 'wearing' column provided by the PhysicalActivity package during nonwear time analysis. This generated a bug when computing the accumulation metrics because the detection of the bouts partly depends on the labels provided in this column. This has been corrected by replacing NAs by "Nonwear".
23

34
# activAnalyzer 2.1.0
45
* Moved 'assertthat' from Suggests to Imports field in DESCRIPTION.

R/compute_accumulation_metrics.R

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,35 @@ if (is.null(dates)) {
104104
selected_dates <- attributes(as.factor(data$date))$levels
105105
} else {
106106
selected_dates <- attributes(as.factor(dates))$levels
107-
}
108-
data <-
109-
data %>%
110-
dplyr::filter(date %in% as.Date(selected_dates) &
111-
.data[[col_time]] >= hms::as_hms(valid_wear_time_start) &
112-
.data[[col_time]] <= hms::as_hms(valid_wear_time_end)
113-
) %>%
114-
dplyr::mutate(new_intensity_category =
115-
dplyr::if_else(.data[[col_cat_int]] == "LPA" | .data[[col_cat_int]] == "MVPA", "PA",
116-
dplyr::if_else(.data[[col_cat_int]] == "SED", "SED",
117-
dplyr::if_else(.data[[col_cat_int]] == "Nonwear", "Nonwear", NA
118-
)))
119-
)
107+
}
108+
109+
# Fix bug: Convert Nas to "Nonwear"
110+
data[[col_cat_int]] <- dplyr::if_else(is.na(data[[col_cat_int]]), "Nonwear", data[[col_cat_int]])
111+
112+
data <-
113+
data %>%
114+
dplyr::filter(
115+
date %in% as.Date(selected_dates) &
116+
.data[[col_time]] >= hms::as_hms(valid_wear_time_start) &
117+
.data[[col_time]] <= hms::as_hms(valid_wear_time_end)
118+
) %>%
119+
dplyr::mutate(
120+
new_intensity_category =
121+
dplyr::if_else(
122+
.data[[col_cat_int]] == "LPA" |
123+
.data[[col_cat_int]] == "MVPA",
124+
"PA",
125+
dplyr::if_else(
126+
.data[[col_cat_int]] == "SED",
127+
"SED",
128+
dplyr::if_else(
129+
.data[[col_cat_int]] == "Nonwear",
130+
"Nonwear",
131+
dplyr::if_else(is.na(.data[[col_cat_int]]), "Nonwear", "Nonwear")
132+
)
133+
)
134+
)
135+
)
120136

121137
# Updating bouts IDs
122138
data$new_intensity_category <- as.factor(data$new_intensity_category)

R/do_all_analyses.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @return
99
#' A dataset (1 row) with all computed metrics.
1010

11-
do_all_analyses <- function(){
11+
do_all_analyses <- function(to_epoch = 60){
1212

1313
# Load file
1414
file <- system.file("extdata", "acc.agd", package = "activAnalyzer")
@@ -17,7 +17,7 @@ do_all_analyses <- function(){
1717
mydata <- prepare_dataset(data = file)
1818

1919
# Detect nonwear time
20-
mydata_with_wear_marks <- mydata %>% mark_wear_time()
20+
mydata_with_wear_marks <- mydata %>% mark_wear_time(to_epoch = to_epoch)
2121

2222
# Add intensity marks
2323
mydata_with_intensity_marks <- mark_intensity(data = mydata_with_wear_marks)

renv.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,13 @@
332332
},
333333
"curl": {
334334
"Package": "curl",
335-
"Version": "5.2.0",
335+
"Version": "5.2.1",
336336
"Source": "Repository",
337-
"Repository": "CRAN",
337+
"Repository": "RSPM",
338338
"Requirements": [
339339
"R"
340340
],
341-
"Hash": "ce88d13c0b10fe88a37d9c59dba2d7f9"
341+
"Hash": "411ca2c03b1ce5f548345d2fc2685f7a"
342342
},
343343
"data.table": {
344344
"Package": "data.table",

0 commit comments

Comments
 (0)