From 3c217b922b0b5efc27e0cb41f91f9521a73970d8 Mon Sep 17 00:00:00 2001 From: Will Beasley Date: Fri, 14 Jul 2023 07:50:53 -0500 Subject: [PATCH] some styler suggestions ref #498 --- R/constant.R | 2 +- R/create-batch-glossary.R | 4 ++-- R/kernel-api.R | 17 ++++++++--------- R/metadata-utilities.R | 6 +++--- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/R/constant.R b/R/constant.R index 272e41fc..438213f0 100644 --- a/R/constant.R +++ b/R/constant.R @@ -23,7 +23,7 @@ #' #' The current constants relate to the 'complete' variable at the #' end of each form. -#' * `form_incomplete`: 0L (*i.e.*, an integer) +#' * `form_incomplete`: 0L (_i.e._, an integer) #' * `form_unverified`: 1L #' * `form_complete`: 2L #' diff --git a/R/create-batch-glossary.R b/R/create-batch-glossary.R index b79df31c..27551e15 100644 --- a/R/create-batch-glossary.R +++ b/R/create-batch-glossary.R @@ -71,12 +71,12 @@ create_batch_glossary <- function(row_count, batch_size) { start_index <- as.integer(base::seq.int(from=1L, to=row_count, by=batch_size)) - ds_batch <- + ds_batch <- tibble::tibble( id = seq_along(start_index), start_index = start_index ) - ds_batch$stop_index <- + ds_batch$stop_index <- base::mapply( function(i) { base::ifelse( diff --git a/R/kernel-api.R b/R/kernel-api.R index 5e0374cb..2f6e4dfa 100644 --- a/R/kernel-api.R +++ b/R/kernel-api.R @@ -41,16 +41,16 @@ #' token <- "9A81268476645C4E5F03428B8AC3AA7B" #' post_body <- list( #' token = token, -#' content = 'project', -#' format = 'csv' +#' content = "project", +#' format = "csv" #' ) #' \dontrun{ #' kernel <- REDCapR:::kernel_api(uri, post_body, config_options) #' #' # Consume the results in a few different ways. #' kernel$result -#' read.csv(text=kernel$raw_text) -#' as.list(read.csv(text=kernel$raw_text)) +#' read.csv(text = kernel$raw_text) +#' as.list(read.csv(text = kernel$raw_text)) #' } kernel_api <- function( @@ -83,9 +83,9 @@ kernel_api <- function( httr::user_agent("OuhscBbmc/REDCapR") ) - status_code <- response$status - success <- (status_code == 200L) - raw_text <- httr::content( + status_code <- response$status + success <- (status_code == 200L) + raw_text <- httr::content( x = response, as = "text", encoding = encoding, # UTF-8 is the default parameter value @@ -104,7 +104,7 @@ kernel_api <- function( any(grepl(regex_cannot_connect, raw_text)) #|| # any(grepl(regex_empty , raw_text)) ) { - success <- FALSE # nocov + success <- FALSE # nocov } return(list( @@ -114,7 +114,6 @@ kernel_api <- function( elapsed_seconds = elapsed_seconds, result = response, result_headers = response$headers, - regex_empty = regex_empty )) } diff --git a/R/metadata-utilities.R b/R/metadata-utilities.R index 7e2942b0..6e22a21b 100644 --- a/R/metadata-utilities.R +++ b/R/metadata-utilities.R @@ -84,9 +84,9 @@ #' @export regex_named_captures <- function(pattern, text, perl = TRUE) { - checkmate::assert_character(pattern, any.missing=FALSE, min.chars=0L, len=1) - checkmate::assert_character(text , any.missing=FALSE, min.chars=0L, len=1) - checkmate::assert_logical( perl , any.missing=FALSE , len=1) + checkmate::assert_character(pattern, any.missing = FALSE, min.chars=0L, len=1) + checkmate::assert_character(text , any.missing = FALSE, min.chars=0L, len=1) + checkmate::assert_logical( perl , any.missing = FALSE, min.chars=0L, len=1) match <- gregexpr(pattern, text, perl = perl)[[1]] capture_names <- attr(match, "capture.names")