-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issue906_create_part6
- Loading branch information
Showing
30 changed files
with
1,030 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ RELEASE_CYCLE.md | |
^docs$ | ||
^pkgdown$ | ||
^vignettes/chapter*.Rmd | ||
^data-raw$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: 'Lock Threads' | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 1 * *' | ||
workflow_dispatch: | ||
|
||
permissions: | ||
issues: write | ||
pull-requests: write | ||
|
||
concurrency: | ||
group: lock | ||
|
||
jobs: | ||
action: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dessant/lock-threads@v4 | ||
with: | ||
issue-inactive-days: '180' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
check_log = function(log, dateformat, colid = 1, datecols = c(), | ||
logPath, logtype) { | ||
|
||
# at the moment this is used only for activity log and study dates log | ||
dateformat_param = ifelse(logtype == "activity log", "qwindow_dateformat", "study_dates_dateformat") | ||
|
||
# assume ID to be in first column | ||
log = log[which(log[, colid] != ""),] # ignore rows for which there is no id | ||
|
||
# replace cells with only a dot by empty character | ||
# the documentation clearly states that no dots should be used | ||
# to indicate missing value, but this is just in case users still forget about it | ||
for (jn in 1:ncol(log)) { | ||
dotcells = which(log[,jn] == ".") | ||
if (length(dotcells) > 0) { | ||
# is.na(actlog_vec[dotcells]) = TRUE | ||
log[dotcells, jn] = "" | ||
} | ||
} | ||
# Check dates | ||
# extract example date value | ||
if (is.null(datecols)) { | ||
datecols = grep(pattern = "date|Date|DATE", x = colnames(log), value = FALSE) | ||
} | ||
if (length(datecols) > 0) { | ||
exampledates = unlist(log[,datecols]) | ||
exampledates = exampledates[which(!is.na(exampledates))] | ||
|
||
e1 = strsplit(exampledates, split = "/|-") | ||
e1 = e1[lengths(e1) > 0L] | ||
date_consistency_check = t(as.data.frame(e1)) | ||
numrange = apply(X = date_consistency_check, MARGIN = 2, FUN = function(x) diff(range(sapply(x, nchar)))) | ||
if (any(numrange > 1)) { | ||
stop(paste0("\nDifferent date formats were encountered in your ", | ||
logtype, ": ", logPath,". ", | ||
"Please note that this may not be visible when you open the ", logtype, | ||
" in MS Excel, but it should be visible in a plain text editor. ", | ||
"To resolve this update the format for all date cells in the ", | ||
"log to be consistent and in line with the value of argument", | ||
dateformat_param, ", which is currently: ", dateformat), call. = FALSE) | ||
} | ||
} else { | ||
exampledates = c() | ||
} | ||
|
||
Nhyphen = length(grep(pattern = "-", x = log[, datecols])) | ||
Ndash = length(grep(pattern = "/", x = log[, datecols])) | ||
if (Nhyphen > 0 & Ndash > 0) { | ||
warning(paste0("\nYou may be mixing slash and hyphen separated dates ", | ||
"inside the same ", logtype , ", which could lead to errors. ", | ||
"Please fix."), | ||
call. = FALSE) | ||
} | ||
# Replace / by - if that is what is expected dateformat | ||
if (Ndash > 0 & length(grep(pattern = "/", x = dateformat)) == 0) { | ||
for (rc in 1:ncol(log)) { | ||
log[, rc] = gsub(pattern = "/", replacement = "-", x = log[, rc]) | ||
} | ||
} | ||
# Replace - by / if that is what is expected dateformat | ||
if (Nhyphen > 0 & length(grep(pattern = "-", x = dateformat)) == 0) { | ||
for (rc in 1:ncol(log)) { | ||
log[, rc] = gsub(pattern = "-", replacement = "/", x = log[, rc]) | ||
} | ||
} | ||
# return | ||
return(log) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.