Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
^vignettes/articles$
^doc$
^Meta$
^CRAN-SUBMISSION$
^cran-comments\.md$
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 1.0.1
Date: 2026-01-24 16:07:33 UTC
SHA: f318da9413869f838bbe595c24b0b272a91520f8
3 changes: 2 additions & 1 deletion R/rd_checkbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,15 @@ rd_checkbox <- function(project = NULL, data = NULL, dic = NULL, event_form = NU

for (i in seq_along(var_check_dic)) {
# Identify variables associated with each checkbox option
vars_data <- names(data)[grep(stringr::str_glue("{var_check_dic[i]}___"), names(data))]
vars_data <- names(data)[grep(stringr::str_glue("^{var_check_dic[i]}___"), names(data))]
vars_data <- vars_data[!grepl(".factor$", vars_data)]

# Retrieve branching logic for the checkbox field
logic <- dic$branching_logic_show_field_only_if[dic$field_name == var_check_dic[i]]

# If there is branching logic, attempt to translate and evaluate it
if (!is.na(logic) & !logic %in% "") {

# Checking if the logic is already in R format
if (grepl("<>|\\[.*?\\]", logic) & !grepl("==|!=|\\$", logic)) {
# Translate REDCap logic to R language using rd_rlogic function
Expand Down
7 changes: 6 additions & 1 deletion R/rd_recalculate.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ rd_recalculate <- function(project = NULL, data = NULL, dic = NULL, event_form =
}

# Proceed only if the project is not longitudinal or has event-form mapping, and is not repeated
if (!(longitudinal & is.null(event_form)) & !repeat_instrument) {
if (!(longitudinal & is.null(event_form))) {

if(repeat_instrument) {
stop("The dataset contains repeated instruments, which are not supported by this function. ", call. = FALSE)
}

# Replace `NA` in branching logic fields with empty strings
if (any(is.na(dic$branching_logic_show_field_only_if))) {
dic <- dic |>
Expand Down
2 changes: 2 additions & 0 deletions R/redcap_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ redcap_data <- function(data_path = NA, dic_path = NA, event_path = NA, uri = NA

var_noevent <- intersect(var_noevent, names(data))

var_noevent <- var_noevent[var_noevent != "record_id"]

data_def$data <- data_def$data |>
dplyr::select(-dplyr::any_of(var_noevent))

Expand Down
8 changes: 8 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## R CMD check results

0 errors | 0 warnings | 0 note

- This is a new release (version 1.0.1).
- Bug fix: `rd_checkbox` now correctly evaluates branching logic after previous `rd_factor` transformations.
- New feature: `redcap_data()` now has a `sep` argument to allow specifying the CSV field separator for the dictionary file.
- No changes in dependencies.