From 940ca16a7f41e0a972a2161c7f798a30bf28fc94 Mon Sep 17 00:00:00 2001 From: Shawn Garbett Date: Wed, 31 Jan 2024 09:55:31 -0600 Subject: [PATCH] Changes required by win-builder devel #318 --- R/documentation-common-args.R | 6 +++--- R/makeApiCall.R | 9 ++++++++- man/fieldCastingFunctions.Rd | 4 ++-- man/recordsTypedMethods.Rd | 6 +++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/R/documentation-common-args.R b/R/documentation-common-args.R index 370cbe1b..94ad4a2a 100644 --- a/R/documentation-common-args.R +++ b/R/documentation-common-args.R @@ -40,9 +40,9 @@ NULL #' @param na A named `list` of user specified functions to determine if the #' data is NA. This is useful when data is loaded that has coding for NA, e.g. #' -5 is NA. Keys must correspond to a truncated REDCap field type, i.e. -#' {date_, datetime_, datetime_seconds_, time_mm_ss, time_hh_mm_ss, time, float, +#' date_, datetime_, datetime_seconds_, time_mm_ss, time_hh_mm_ss, time, float, #' number, calc, int, integer, select, radio, dropdown, yesno, truefalse, -#' checkbox, form_complete, sql, system}. The function will be provided the +#' checkbox, form_complete, sql, system. The function will be provided the #' variables (x, field_name, coding). The function must return a vector of #' logicals matching the input. It defaults to [isNAorBlank()] for all #' entries. @@ -61,7 +61,7 @@ NULL #' @param assignment A named `list` of functions. These functions are provided, field_name, #' label, description and field_type and return a list of attributes to assign #' to the column. Defaults to creating a label attribute from the stripped -#' HTML and UNICODE raw label and scanning for units={"UNITS"} in description +#' HTML and UNICODE raw label and scanning for units=\{"UNITS"\} in description NULL diff --git a/R/makeApiCall.R b/R/makeApiCall.R index df751132..d63e2fd9 100644 --- a/R/makeApiCall.R +++ b/R/makeApiCall.R @@ -260,8 +260,15 @@ makeApiCall <- function(rcon, } # Helper function to convert responses to character strings without crashing. -as.data.frame.response <- function(x, stringsAsFactors=FALSE, na.strings = "", ...) +as.data.frame.response <- function(x, row.names=NULL, optional=FALSE, ...) { + # Setting defaults, necessary because cannot change S3 interface + extra <- list(...) + stringsAsFactors <- extra$stringsAsFactors + if(is.null(stringsAsFactors)) stringsAsFactors <- FALSE + na.strings <- extra$na.strings + if(is.null(na.strings)) na.strings <- "" + enc <- if(grepl("charset", x$headers[["Content-Type"]])) toupper(sub('.*charset=([^;]+).*', '\\1', x$headers[["Content-Type"]])) else 'ISO-8859-1' # [Default if unspecified](https://www.w3.org/International/articles/http-charset/index) diff --git a/man/fieldCastingFunctions.Rd b/man/fieldCastingFunctions.Rd index b5a8e3ab..648ce475 100644 --- a/man/fieldCastingFunctions.Rd +++ b/man/fieldCastingFunctions.Rd @@ -82,9 +82,9 @@ the result will have one column with the coded values \item{na}{A named \code{list} of user specified functions to determine if the data is NA. This is useful when data is loaded that has coding for NA, e.g. -5 is NA. Keys must correspond to a truncated REDCap field type, i.e. -{date_, datetime_, datetime_seconds_, time_mm_ss, time_hh_mm_ss, time, float, +date_, datetime_, datetime_seconds_, time_mm_ss, time_hh_mm_ss, time, float, number, calc, int, integer, select, radio, dropdown, yesno, truefalse, -checkbox, form_complete, sql, system}. The function will be provided the +checkbox, form_complete, sql, system. The function will be provided the variables (x, field_name, coding). The function must return a vector of logicals matching the input. It defaults to \code{\link[=isNAorBlank]{isNAorBlank()}} for all entries.} diff --git a/man/recordsTypedMethods.Rd b/man/recordsTypedMethods.Rd index c6c92a37..918f0d17 100644 --- a/man/recordsTypedMethods.Rd +++ b/man/recordsTypedMethods.Rd @@ -121,9 +121,9 @@ Otherwise, records created or modified before this date will be returned.} \item{na}{A named \code{list} of user specified functions to determine if the data is NA. This is useful when data is loaded that has coding for NA, e.g. -5 is NA. Keys must correspond to a truncated REDCap field type, i.e. -{date_, datetime_, datetime_seconds_, time_mm_ss, time_hh_mm_ss, time, float, +date_, datetime_, datetime_seconds_, time_mm_ss, time_hh_mm_ss, time, float, number, calc, int, integer, select, radio, dropdown, yesno, truefalse, -checkbox, form_complete, sql, system}. The function will be provided the +checkbox, form_complete, sql, system. The function will be provided the variables (x, field_name, coding). The function must return a vector of logicals matching the input. It defaults to \code{\link[=isNAorBlank]{isNAorBlank()}} for all entries.} @@ -145,7 +145,7 @@ the desired intent. See \code{\link[=fieldValidationAndCasting]{fieldValidationA \item{assignment}{A named \code{list} of functions. These functions are provided, field_name, label, description and field_type and return a list of attributes to assign to the column. Defaults to creating a label attribute from the stripped -HTML and UNICODE raw label and scanning for units={"UNITS"} in description} +HTML and UNICODE raw label and scanning for units=\{"UNITS"\} in description} \item{filter_empty_rows}{\code{logical(1)}. Filter out empty rows post retrieval. Defaults to \code{TRUE}.}