diff --git a/.Rbuildignore b/.Rbuildignore index 60d60ae..f15ca0d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,5 @@ ^vignettes/articles$ ^doc$ ^Meta$ +^CRAN-SUBMISSION$ +^cran-comments\.md$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..46745b1 --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 1.0.1 +Date: 2026-01-24 16:07:33 UTC +SHA: f318da9413869f838bbe595c24b0b272a91520f8 diff --git a/R/rd_checkbox.R b/R/rd_checkbox.R index d6be172..714218a 100644 --- a/R/rd_checkbox.R +++ b/R/rd_checkbox.R @@ -175,7 +175,7 @@ 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 @@ -183,6 +183,7 @@ rd_checkbox <- function(project = NULL, data = NULL, dic = NULL, event_form = NU # 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 diff --git a/R/rd_recalculate.R b/R/rd_recalculate.R index 9d08bde..e74f2ff 100644 --- a/R/rd_recalculate.R +++ b/R/rd_recalculate.R @@ -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 |> diff --git a/R/redcap_data.R b/R/redcap_data.R index 80ee454..069c9aa 100644 --- a/R/redcap_data.R +++ b/R/redcap_data.R @@ -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)) diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..3f62299 --- /dev/null +++ b/cran-comments.md @@ -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.