Skip to content

Commit

Permalink
error if events are passed to a nonlongitudinal project
Browse files Browse the repository at this point in the history
ref #492
  • Loading branch information
wibeasley committed Jul 9, 2023
1 parent 3d22f91 commit bdccf8d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/redcap-read.R
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,12 @@ redcap_read <- function(
handle_httr = handle_httr
)

# browser()
if (!is.null(fields) || !is.null(forms))
if (!is.null(events) && !metadata$longitudinal) {
stop("This project is NOT longitudinal, so do not pass a value to the `event` argument.")
} else if (!is.null(fields) || !is.null(forms)) {
fields <- base::union(metadata$record_id_name, fields)
# fields <- base::union(metadata$plumbing_variables, fields)
}

# Retrieve list of record ids --------------------------------------
initial_call <- REDCapR::redcap_read_oneshot(
Expand Down Expand Up @@ -405,6 +407,7 @@ redcap_read <- function(
" (ie, ", length(selected_ids), " unique subject records)."
)
}

read_result <- REDCapR::redcap_read_oneshot(
redcap_uri = redcap_uri,
token = token,
Expand Down

0 comments on commit bdccf8d

Please sign in to comment.