diff --git a/DESCRIPTION b/DESCRIPTION index d96b18fc..68597de6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,8 +6,8 @@ Description: Encapsulates functions to streamline calls from R to the REDCap University. The Application Programming Interface (API) offers an avenue to access and modify data programmatically, improving the capacity for literate and reproducible programming. -Version: 0.9.10.9001 -Date: 2019-01-09 +Version: 0.9.10.9002 +Date: 2019-03-12 Authors@R: c(person("Will", "Beasley", role = c("aut", "cre"), email = "wibeasley@hotmail.com", comment = c(ORCID = "0000-0002-5613-5006")), person("David", "Bard", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 2a6f8012..8e692225 100644 --- a/NEWS.md +++ b/NEWS.md @@ -23,9 +23,10 @@ Version 0.10 (to be released) * If no records are affected, a zero-length *character* vector is returned (instead of sometimes a zero-length *numeric* vector) (#212) * New function (called `constants()`) easily exposes REDCap-specific constants. (#217) * `id_position` allows user to specify if the record_id isn't in the first position (#207). However, we recommend that all REDCap projects keep this important variable first in the data dictionary. -* Link to new secure Zenodo DOI resolver (katrinleinweber #191) +* Link to new secure Zenodo DOI resolver (@katrinleinweber #191) * parameters in `redcap_read()` and `redcap_read_oneshot()` are more consistent with the order in raw REDCap API. (#204) * When the `verbose` parameter is NULL, then the value from getOption("verbose") is used. (#215) +* `guess_max` parameter provided in `redcap_read()` (no longer just `redcap_read_oneshot()`). Suggested by @isaactpetersen in #245. * Documentation website constructed with pkgdown (#224). ### Modified Internals diff --git a/R/redcap-read.R b/R/redcap-read.R index efb99ffd..0c5289cf 100644 --- a/R/redcap-read.R +++ b/R/redcap-read.R @@ -27,6 +27,7 @@ #' @param filter_logic String of logic text (e.g., `[gender] = 'male'`) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. An blank/empty string returns all records. #' #' @param guess_type A boolean value indicating if all columns should be returned as character. If true, [readr::read_csv()] guesses the intended data type for each column. +#' @param guess_max A positive integer passed to [readr::read_csv()] **per batch** that specifies the maximum number of records to use for guessing column types. #' @param verbose A boolean value indicating if `message`s should be printed to the R console during the operation. The verbose output might contain sensitive information (*e.g.* PHI), so turn this off if the output might be visible somewhere public. Optional. #' @param config_options A list of options to pass to `POST` method in the `httr` package. See the details in `redcap_read_oneshot()` Optional. #' @param id_position The column position of the variable that unique identifies the subject. This defaults to the first variable in the dataset. @@ -89,6 +90,7 @@ redcap_read <- function( filter_logic = "", guess_type = TRUE, + guess_max = 1000L, verbose = TRUE, config_options = NULL, id_position = 1L @@ -114,6 +116,7 @@ redcap_read <- function( checkmate::assert_logical( export_data_access_groups , any.missing=F, len=1) # checkmate::assert_logical( guess_type , any.missing=F, len=1) + checkmate::assert_integerish(guess_max , any.missing=F, len=1, lower=1) checkmate::assert_logical( verbose , any.missing=F, len=1, null.ok=T) checkmate::assert_list( config_options , any.missing=T, len=1, null.ok=T) checkmate::assert_integer( id_position , any.missing=F, len=1, lower=1L) @@ -209,6 +212,7 @@ redcap_read <- function( filter_logic = filter_logic, guess_type = guess_type, + guess_max = guess_max, verbose = verbose, config_options = config_options ) diff --git a/man/redcap_read.Rd b/man/redcap_read.Rd index c225c465..074cdb46 100644 --- a/man/redcap_read.Rd +++ b/man/redcap_read.Rd @@ -11,8 +11,8 @@ redcap_read(batch_size = 100L, interbatch_delay = 0.5, events_collapsed = "", raw_or_label = "raw", raw_or_label_headers = "raw", export_checkbox_label = FALSE, export_survey_fields = FALSE, export_data_access_groups = FALSE, - filter_logic = "", guess_type = TRUE, verbose = TRUE, - config_options = NULL, id_position = 1L) + filter_logic = "", guess_type = TRUE, guess_max = 1000L, + verbose = TRUE, config_options = NULL, id_position = 1L) } \arguments{ \item{batch_size}{The maximum number of subject records a single batch should contain. The default is 100.} @@ -55,6 +55,8 @@ redcap_read(batch_size = 100L, interbatch_delay = 0.5, \item{guess_type}{A boolean value indicating if all columns should be returned as character. If true, \code{\link[readr:read_csv]{readr::read_csv()}} guesses the intended data type for each column.} +\item{guess_max}{A positive integer passed to \code{\link[readr:read_csv]{readr::read_csv()}} \strong{per batch} that specifies the maximum number of records to use for guessing column types.} + \item{verbose}{A boolean value indicating if \code{message}s should be printed to the R console during the operation. The verbose output might contain sensitive information (\emph{e.g.} PHI), so turn this off if the output might be visible somewhere public. Optional.} \item{config_options}{A list of options to pass to \code{POST} method in the \code{httr} package. See the details in \code{redcap_read_oneshot()} Optional.}