From c2fbc3b77d6126b6d2f9a73f7dbfd7b83fa34b8a Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Mon, 2 Aug 2021 12:06:01 +0100 Subject: [PATCH 1/4] Assign values in examples so less noisy output --- r/R/compute.R | 7 +++---- r/R/dataset.R | 2 +- r/R/ipc_stream.R | 4 ++-- r/man/list_compute_functions.Rd | 5 ++--- r/man/open_dataset.Rd | 2 +- r/man/value_counts.Rd | 2 +- r/man/write_to_raw.Rd | 4 ++-- 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/r/R/compute.R b/r/R/compute.R index 5c27e206d7e..2cece2fbfc7 100644 --- a/r/R/compute.R +++ b/r/R/compute.R @@ -89,9 +89,8 @@ call_function <- function(function_name, ..., args = list(...), options = empty_ #' @param ... Additional parameters passed to `grep()` #' @return A character vector of available Arrow C++ function names #' @examplesIf arrow_available() -#' list_compute_functions() -#' list_compute_functions(pattern = "^UTF8", ignore.case = TRUE) -#' list_compute_functions(pattern = "^is", invert = TRUE) +#' available_funcs <- list_compute_functions() +#' utf8_funcs <- list_compute_functions(pattern = "^UTF8", ignore.case = TRUE) #' @export list_compute_functions <- function(pattern = NULL, ...) { funcs <- compute__GetFunctionNames() @@ -284,7 +283,7 @@ is_in <- function(x, table, ...) { #' `Int64`. #' @examplesIf arrow_available() #' cyl_vals <- Array$create(mtcars$cyl) -#' value_counts(cyl_vals) +#' counts <- value_counts(cyl_vals) #' @export value_counts <- function(x) { call_function("value_counts", x) diff --git a/r/R/dataset.R b/r/R/dataset.R index eb7cfaf4f44..072a0f3ae96 100644 --- a/r/R/dataset.R +++ b/r/R/dataset.R @@ -118,7 +118,7 @@ #' #' # View files - you can see the partitioning means that files have been written #' # to folders based on Month/Day values -#' list.files(tf3, recursive = TRUE) +#' tf3_files <- list.files(tf3, recursive = TRUE) #' #' # With no partitioning specified, dataset contains all files but doesn't include #' # directory names as field names diff --git a/r/R/ipc_stream.R b/r/R/ipc_stream.R index 1e101d84e3c..43734f52b1c 100644 --- a/r/R/ipc_stream.R +++ b/r/R/ipc_stream.R @@ -68,8 +68,8 @@ write_ipc_stream <- function(x, sink, ...) { #' @return A `raw` vector containing the bytes of the IPC serialized data. #' @examplesIf arrow_available() #' # The default format is "stream" -#' write_to_raw(mtcars) -#' write_to_raw(mtcars, format = "file") +#' mtcars_raw <- write_to_raw(mtcars) +#' mtcars_raw_file <- write_to_raw(mtcars, format = "file") #' @export write_to_raw <- function(x, format = c("stream", "file")) { sink <- BufferOutputStream$create() diff --git a/r/man/list_compute_functions.Rd b/r/man/list_compute_functions.Rd index 4ca0e518f13..b29be51cd5b 100644 --- a/r/man/list_compute_functions.Rd +++ b/r/man/list_compute_functions.Rd @@ -39,8 +39,7 @@ available inside \code{dplyr} verbs. } \examples{ \dontshow{if (arrow_available()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -list_compute_functions() -list_compute_functions(pattern = "^UTF8", ignore.case = TRUE) -list_compute_functions(pattern = "^is", invert = TRUE) +available_funcs <- list_compute_functions() +utf8_funcs <- list_compute_functions(pattern = "^UTF8", ignore.case = TRUE) \dontshow{\}) # examplesIf} } diff --git a/r/man/open_dataset.Rd b/r/man/open_dataset.Rd index 53eade595be..59717863932 100644 --- a/r/man/open_dataset.Rd +++ b/r/man/open_dataset.Rd @@ -128,7 +128,7 @@ write_dataset(airquality, tf3, partitioning = c("Month", "Day"), hive_style = FA # View files - you can see the partitioning means that files have been written # to folders based on Month/Day values -list.files(tf3, recursive = TRUE) +tf3_files <- list.files(tf3, recursive = TRUE) # With no partitioning specified, dataset contains all files but doesn't include # directory names as field names diff --git a/r/man/value_counts.Rd b/r/man/value_counts.Rd index 6ef77cd4727..7e64d1550cf 100644 --- a/r/man/value_counts.Rd +++ b/r/man/value_counts.Rd @@ -19,6 +19,6 @@ This function tabulates the values in the array and returns a table of counts. \examples{ \dontshow{if (arrow_available()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cyl_vals <- Array$create(mtcars$cyl) -value_counts(cyl_vals) +counts <- value_counts(cyl_vals) \dontshow{\}) # examplesIf} } diff --git a/r/man/write_to_raw.Rd b/r/man/write_to_raw.Rd index 1f507e384c3..a19ec8c7c28 100644 --- a/r/man/write_to_raw.Rd +++ b/r/man/write_to_raw.Rd @@ -23,7 +23,7 @@ access that buffer as a \code{raw} vector in R. \examples{ \dontshow{if (arrow_available()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # The default format is "stream" -write_to_raw(mtcars) -write_to_raw(mtcars, format = "file") +mtcars_raw <- write_to_raw(mtcars) +mtcars_raw_file <- write_to_raw(mtcars, format = "file") \dontshow{\}) # examplesIf} } From b76a5471f625e93a2cd5efa2c2252f84c80df2ec Mon Sep 17 00:00:00 2001 From: Nic Date: Wed, 4 Aug 2021 10:25:53 +0000 Subject: [PATCH 2/4] remove write_to_raw example that isn't needed Co-authored-by: Neal Richardson --- r/R/ipc_stream.R | 1 - 1 file changed, 1 deletion(-) diff --git a/r/R/ipc_stream.R b/r/R/ipc_stream.R index 43734f52b1c..c45d1de6e33 100644 --- a/r/R/ipc_stream.R +++ b/r/R/ipc_stream.R @@ -69,7 +69,6 @@ write_ipc_stream <- function(x, sink, ...) { #' @examplesIf arrow_available() #' # The default format is "stream" #' mtcars_raw <- write_to_raw(mtcars) -#' mtcars_raw_file <- write_to_raw(mtcars, format = "file") #' @export write_to_raw <- function(x, format = c("stream", "file")) { sink <- BufferOutputStream$create() From 3a33e22cac1fe557b332bf441c051e9ef9412fe0 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Wed, 4 Aug 2021 08:40:22 -0400 Subject: [PATCH 3/4] Update r/R/compute.R --- r/R/compute.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/R/compute.R b/r/R/compute.R index 2cece2fbfc7..8cfaaf7b415 100644 --- a/r/R/compute.R +++ b/r/R/compute.R @@ -89,7 +89,7 @@ call_function <- function(function_name, ..., args = list(...), options = empty_ #' @param ... Additional parameters passed to `grep()` #' @return A character vector of available Arrow C++ function names #' @examplesIf arrow_available() -#' available_funcs <- list_compute_functions() +#' available_funcs <- list_compute_functions() #' utf8_funcs <- list_compute_functions(pattern = "^UTF8", ignore.case = TRUE) #' @export list_compute_functions <- function(pattern = NULL, ...) { From 1ab61387e9ab0a46a0411febf8d39ddcb846efbe Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Wed, 4 Aug 2021 15:43:52 -0400 Subject: [PATCH 4/4] Regenerate docs after rebase --- r/man/list_compute_functions.Rd | 2 +- r/man/write_to_raw.Rd | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/r/man/list_compute_functions.Rd b/r/man/list_compute_functions.Rd index b29be51cd5b..45e0338368e 100644 --- a/r/man/list_compute_functions.Rd +++ b/r/man/list_compute_functions.Rd @@ -39,7 +39,7 @@ available inside \code{dplyr} verbs. } \examples{ \dontshow{if (arrow_available()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} -available_funcs <- list_compute_functions() +available_funcs <- list_compute_functions() utf8_funcs <- list_compute_functions(pattern = "^UTF8", ignore.case = TRUE) \dontshow{\}) # examplesIf} } diff --git a/r/man/write_to_raw.Rd b/r/man/write_to_raw.Rd index a19ec8c7c28..a3c6e324b54 100644 --- a/r/man/write_to_raw.Rd +++ b/r/man/write_to_raw.Rd @@ -24,6 +24,5 @@ access that buffer as a \code{raw} vector in R. \dontshow{if (arrow_available()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # The default format is "stream" mtcars_raw <- write_to_raw(mtcars) -mtcars_raw_file <- write_to_raw(mtcars, format = "file") \dontshow{\}) # examplesIf} }