diff --git a/r/R/csv.R b/r/R/csv.R index 7acb667c9e0..709b42ab8a0 100644 --- a/r/R/csv.R +++ b/r/R/csv.R @@ -63,10 +63,10 @@ #' parsing options provided in other arguments (e.g. `delim`, `quote`, etc.). #' @param convert_options see [csv_convert_options()] #' @param read_options see [csv_read_options()] -#' @param as_tibble Should the function return a `data.frame` or an +#' @param as_data_frame Should the function return a `data.frame` or an #' [arrow::Table][Table]? #' -#' @return A `data.frame`, or an Table if `as_tibble = FALSE`. +#' @return A `data.frame`, or an Table if `as_data_frame = FALSE`. #' @export #' @examples #' \donttest{ @@ -95,7 +95,7 @@ read_delim_arrow <- function(file, parse_options = NULL, convert_options = NULL, read_options = NULL, - as_tibble = TRUE) { + as_data_frame = TRUE) { if (is.null(parse_options)) { parse_options <- readr_to_csv_parse_options( @@ -124,7 +124,7 @@ read_delim_arrow <- function(file, tab <- reader$Read()$select(!!enquo(col_select)) - if (isTRUE(as_tibble)) { + if (isTRUE(as_data_frame)) { tab <- as.data.frame(tab) } @@ -147,7 +147,7 @@ read_csv_arrow <- function(file, parse_options = NULL, convert_options = NULL, read_options = NULL, - as_tibble = TRUE) { + as_data_frame = TRUE) { mc <- match.call() mc$delim <- "," @@ -171,7 +171,7 @@ read_tsv_arrow <- function(file, parse_options = NULL, convert_options = NULL, read_options = NULL, - as_tibble = TRUE) { + as_data_frame = TRUE) { mc <- match.call() mc$delim <- "\t" diff --git a/r/R/feather.R b/r/R/feather.R index d835ae266ff..e1b74bdda9c 100644 --- a/r/R/feather.R +++ b/r/R/feather.R @@ -96,7 +96,7 @@ FeatherTableWriter$create <- function(stream) { #' @inheritParams read_delim_arrow #' @param ... additional parameters #' -#' @return A `data.frame` if `as_tibble` is `TRUE` (the default), or an +#' @return A `data.frame` if `as_data_frame` is `TRUE` (the default), or an #' [arrow::Table][Table] otherwise #' #' @export @@ -112,7 +112,7 @@ FeatherTableWriter$create <- function(stream) { #' df <- read_feather(tf, col_select = starts_with("Sepal")) #' }) #' } -read_feather <- function(file, col_select = NULL, as_tibble = TRUE, ...) { +read_feather <- function(file, col_select = NULL, as_data_frame = TRUE, ...) { reader <- FeatherTableReader$create(file, ...) all_columns <- ipc___feather___TableReader__column_names(reader) @@ -122,7 +122,7 @@ read_feather <- function(file, col_select = NULL, as_tibble = TRUE, ...) { } out <- reader$Read(columns) - if (isTRUE(as_tibble)) { + if (isTRUE(as_data_frame)) { out <- as.data.frame(out) } out diff --git a/r/R/json.R b/r/R/json.R index bf038a18fa9..063de39a186 100644 --- a/r/R/json.R +++ b/r/R/json.R @@ -22,7 +22,7 @@ #' @inheritParams read_delim_arrow #' @param ... Additional options, passed to `json_table_reader()` #' -#' @return A `data.frame`, or an Table if `as_tibble = FALSE`. +#' @return A `data.frame`, or an Table if `as_data_frame = FALSE`. #' @export #' @examples #' \donttest{ @@ -37,10 +37,10 @@ #' df <- read_json_arrow(tf) #' }) #' } -read_json_arrow <- function(file, col_select = NULL, as_tibble = TRUE, ...) { +read_json_arrow <- function(file, col_select = NULL, as_data_frame = TRUE, ...) { tab <- json_table_reader(file, ...)$Read()$select(!!enquo(col_select)) - if (isTRUE(as_tibble)) { + if (isTRUE(as_data_frame)) { tab <- as.data.frame(tab) } tab diff --git a/r/R/parquet.R b/r/R/parquet.R index 3e85570ea64..d36e5c33dd7 100644 --- a/r/R/parquet.R +++ b/r/R/parquet.R @@ -25,7 +25,7 @@ #' @param props [ParquetReaderProperties] #' @param ... Additional arguments passed to `ParquetFileReader$create()` #' -#' @return A [arrow::Table][Table], or a `data.frame` if `as_tibble` is +#' @return A [arrow::Table][Table], or a `data.frame` if `as_data_frame` is #' `TRUE`. #' @examples #' \donttest{ @@ -35,13 +35,13 @@ #' @export read_parquet <- function(file, col_select = NULL, - as_tibble = TRUE, + as_data_frame = TRUE, props = ParquetReaderProperties$create(), ...) { reader <- ParquetFileReader$create(file, props = props, ...) tab <- reader$ReadTable(!!enquo(col_select)) - if (as_tibble) { + if (as_data_frame) { tab <- as.data.frame(tab) } tab diff --git a/r/man/read_delim_arrow.Rd b/r/man/read_delim_arrow.Rd index d0cd4fb2e2e..fcab79f8242 100644 --- a/r/man/read_delim_arrow.Rd +++ b/r/man/read_delim_arrow.Rd @@ -10,19 +10,19 @@ read_delim_arrow(file, delim = ",", quote = "\\"", escape_double = TRUE, escape_backslash = FALSE, col_names = TRUE, col_select = NULL, na = c("", "NA"), quoted_na = TRUE, skip_empty_rows = TRUE, skip = 0L, parse_options = NULL, - convert_options = NULL, read_options = NULL, as_tibble = TRUE) + convert_options = NULL, read_options = NULL, as_data_frame = TRUE) read_csv_arrow(file, quote = "\\"", escape_double = TRUE, escape_backslash = FALSE, col_names = TRUE, col_select = NULL, na = c("", "NA"), quoted_na = TRUE, skip_empty_rows = TRUE, skip = 0L, parse_options = NULL, convert_options = NULL, - read_options = NULL, as_tibble = TRUE) + read_options = NULL, as_data_frame = TRUE) read_tsv_arrow(file, quote = "\\"", escape_double = TRUE, escape_backslash = FALSE, col_names = TRUE, col_select = NULL, na = c("", "NA"), quoted_na = TRUE, skip_empty_rows = TRUE, skip = 0L, parse_options = NULL, convert_options = NULL, - read_options = NULL, as_tibble = TRUE) + read_options = NULL, as_data_frame = TRUE) } \arguments{ \item{file}{A character file name, raw vector, or an Arrow input stream} @@ -70,11 +70,11 @@ parsing options provided in other arguments (e.g. \code{delim}, \code{quote}, et \item{read_options}{see \code{\link[=csv_read_options]{csv_read_options()}}} -\item{as_tibble}{Should the function return a \code{data.frame} or an +\item{as_data_frame}{Should the function return a \code{data.frame} or an \link[=Table]{arrow::Table}?} } \value{ -A \code{data.frame}, or an Table if \code{as_tibble = FALSE}. +A \code{data.frame}, or an Table if \code{as_data_frame = FALSE}. } \description{ These functions uses the Arrow C++ CSV reader to read into a \code{data.frame}. diff --git a/r/man/read_feather.Rd b/r/man/read_feather.Rd index 7e720059af7..ac6b8ec8b48 100644 --- a/r/man/read_feather.Rd +++ b/r/man/read_feather.Rd @@ -4,7 +4,7 @@ \alias{read_feather} \title{Read a Feather file} \usage{ -read_feather(file, col_select = NULL, as_tibble = TRUE, ...) +read_feather(file, col_select = NULL, as_data_frame = TRUE, ...) } \arguments{ \item{file}{A character file path, a raw vector, or \code{InputStream}, passed to @@ -15,13 +15,13 @@ read_feather(file, col_select = NULL, as_tibble = TRUE, ...) \link[tidyselect:vars_select]{tidy selection specification} of columns, as used in \code{dplyr::select()}.} -\item{as_tibble}{Should the function return a \code{data.frame} or an +\item{as_data_frame}{Should the function return a \code{data.frame} or an \link[=Table]{arrow::Table}?} \item{...}{additional parameters} } \value{ -A \code{data.frame} if \code{as_tibble} is \code{TRUE} (the default), or an +A \code{data.frame} if \code{as_data_frame} is \code{TRUE} (the default), or an \link[=Table]{arrow::Table} otherwise } \description{ diff --git a/r/man/read_json_arrow.Rd b/r/man/read_json_arrow.Rd index 7fcad2c4509..98936ea959b 100644 --- a/r/man/read_json_arrow.Rd +++ b/r/man/read_json_arrow.Rd @@ -4,7 +4,7 @@ \alias{read_json_arrow} \title{Read a JSON file} \usage{ -read_json_arrow(file, col_select = NULL, as_tibble = TRUE, ...) +read_json_arrow(file, col_select = NULL, as_data_frame = TRUE, ...) } \arguments{ \item{file}{A character file name, raw vector, or an Arrow input stream} @@ -14,13 +14,13 @@ read_json_arrow(file, col_select = NULL, as_tibble = TRUE, ...) \link[tidyselect:vars_select]{tidy selection specification} of columns, as used in \code{dplyr::select()}.} -\item{as_tibble}{Should the function return a \code{data.frame} or an +\item{as_data_frame}{Should the function return a \code{data.frame} or an \link[=Table]{arrow::Table}?} \item{...}{Additional options, passed to \code{json_table_reader()}} } \value{ -A \code{data.frame}, or an Table if \code{as_tibble = FALSE}. +A \code{data.frame}, or an Table if \code{as_data_frame = FALSE}. } \description{ Using \link{JsonTableReader} diff --git a/r/man/read_parquet.Rd b/r/man/read_parquet.Rd index 5a12e7199f2..757d82e184a 100644 --- a/r/man/read_parquet.Rd +++ b/r/man/read_parquet.Rd @@ -4,7 +4,7 @@ \alias{read_parquet} \title{Read a Parquet file} \usage{ -read_parquet(file, col_select = NULL, as_tibble = TRUE, +read_parquet(file, col_select = NULL, as_data_frame = TRUE, props = ParquetReaderProperties$create(), ...) } \arguments{ @@ -15,7 +15,7 @@ read_parquet(file, col_select = NULL, as_tibble = TRUE, \link[tidyselect:vars_select]{tidy selection specification} of columns, as used in \code{dplyr::select()}.} -\item{as_tibble}{Should the function return a \code{data.frame} or an +\item{as_data_frame}{Should the function return a \code{data.frame} or an \link[=Table]{arrow::Table}?} \item{props}{\link{ParquetReaderProperties}} @@ -23,7 +23,7 @@ of columns, as used in \code{dplyr::select()}.} \item{...}{Additional arguments passed to \code{ParquetFileReader$create()}} } \value{ -A \link[=Table]{arrow::Table}, or a \code{data.frame} if \code{as_tibble} is +A \link[=Table]{arrow::Table}, or a \code{data.frame} if \code{as_data_frame} is \code{TRUE}. } \description{ diff --git a/r/tests/testthat/test-csv.R b/r/tests/testthat/test-csv.R index 24354a14186..288396f82fe 100644 --- a/r/tests/testthat/test-csv.R +++ b/r/tests/testthat/test-csv.R @@ -23,9 +23,9 @@ test_that("Can read csv file", { write.csv(iris, tf, row.names = FALSE) - tab1 <- read_csv_arrow(tf, as_tibble = FALSE) - tab2 <- read_csv_arrow(mmap_open(tf), as_tibble = FALSE) - tab3 <- read_csv_arrow(ReadableFile$create(tf), as_tibble = FALSE) + tab1 <- read_csv_arrow(tf, as_data_frame = FALSE) + tab2 <- read_csv_arrow(mmap_open(tf), as_data_frame = FALSE) + tab3 <- read_csv_arrow(ReadableFile$create(tf), as_data_frame = FALSE) iris$Species <- as.character(iris$Species) tab0 <- Table$create(!!!iris) @@ -34,15 +34,15 @@ test_that("Can read csv file", { expect_equal(tab0, tab3) }) -test_that("read_csv_arrow(as_tibble=TRUE)", { +test_that("read_csv_arrow(as_data_frame=TRUE)", { tf <- tempfile() on.exit(unlink(tf)) write.csv(iris, tf, row.names = FALSE) - tab1 <- read_csv_arrow(tf, as_tibble = TRUE) - tab2 <- read_csv_arrow(mmap_open(tf), as_tibble = TRUE) - tab3 <- read_csv_arrow(ReadableFile$create(tf), as_tibble = TRUE) + tab1 <- read_csv_arrow(tf, as_data_frame = TRUE) + tab2 <- read_csv_arrow(mmap_open(tf), as_data_frame = TRUE) + tab3 <- read_csv_arrow(ReadableFile$create(tf), as_data_frame = TRUE) iris$Species <- as.character(iris$Species) expect_equivalent(iris, tab1) @@ -170,9 +170,9 @@ test_that("read_csv_arrow() respects col_select", { write.csv(iris, tf, row.names = FALSE, quote = FALSE) - tab <- read_csv_arrow(tf, col_select = starts_with("Sepal"), as_tibble = FALSE) + tab <- read_csv_arrow(tf, col_select = starts_with("Sepal"), as_data_frame = FALSE) expect_equal(tab, Table$create(Sepal.Length = iris$Sepal.Length, Sepal.Width = iris$Sepal.Width)) - tib <- read_csv_arrow(tf, col_select = starts_with("Sepal"), as_tibble = TRUE) + tib <- read_csv_arrow(tf, col_select = starts_with("Sepal"), as_data_frame = TRUE) expect_equal(tib, tibble::tibble(Sepal.Length = iris$Sepal.Length, Sepal.Width = iris$Sepal.Width)) }) diff --git a/r/tests/testthat/test-feather.R b/r/tests/testthat/test-feather.R index 0ab20bff546..e0144e69853 100644 --- a/r/tests/testthat/test-feather.R +++ b/r/tests/testthat/test-feather.R @@ -94,7 +94,7 @@ test_that("feather handles col_select = ", { }) test_that("feather read/write round trip", { - tab1 <- read_feather(feather_file, as_tibble = FALSE) + tab1 <- read_feather(feather_file, as_data_frame = FALSE) expect_is(tab1, "Table") expect_equal(tib, as.data.frame(tab1)) diff --git a/r/tests/testthat/test-json.R b/r/tests/testthat/test-json.R index c436cb72596..e0c155667f2 100644 --- a/r/tests/testthat/test-json.R +++ b/r/tests/testthat/test-json.R @@ -27,9 +27,9 @@ test_that("Can read json file with scalars columns (ARROW-5503)", { { "hello": 0.0, "world": true, "yo": null } ', tf, useBytes=TRUE) - tab1 <- read_json_arrow(tf, as_tibble = FALSE) - tab2 <- read_json_arrow(mmap_open(tf), as_tibble = FALSE) - tab3 <- read_json_arrow(ReadableFile$create(tf), as_tibble = FALSE) + tab1 <- read_json_arrow(tf, as_data_frame = FALSE) + tab2 <- read_json_arrow(mmap_open(tf), as_data_frame = FALSE) + tab3 <- read_json_arrow(ReadableFile$create(tf), as_data_frame = FALSE) expect_equal(tab1, tab2) expect_equal(tab1, tab3) @@ -98,9 +98,9 @@ test_that("Can read json file with nested columns (ARROW-5503)", { { "arr": [5.0, 6.0], "nuf": { "ps": 19 } } ', tf) - tab1 <- read_json_arrow(tf, as_tibble = FALSE) - tab2 <- read_json_arrow(mmap_open(tf), as_tibble = FALSE) - tab3 <- read_json_arrow(ReadableFile$create(tf), as_tibble = FALSE) + tab1 <- read_json_arrow(tf, as_data_frame = FALSE) + tab2 <- read_json_arrow(mmap_open(tf), as_data_frame = FALSE) + tab3 <- read_json_arrow(ReadableFile$create(tf), as_data_frame = FALSE) expect_equal(tab1, tab2) expect_equal(tab1, tab3)