Skip to content

Commit 4b5ca3d

Browse files
jameslambnealrichardson
authored andcommitted
ARROW-6337: [R] Changed as_tible to as_dataframe in the R package
See [ARROW-6337](https://issues.apache.org/jira/browse/ARROW-6337) for background on this PR. Closes apache#5399 from jameslamb/as_dataframe and squashes the following commits: 66137bb <James Lamb> ARROW-6337: Changed as_tible to as_data_frame in the R package 066f002 <James Lamb> ARROW-6337: Changed as_tible to as_dataframe in the R package Authored-by: James Lamb <jaylamb20@gmail.com> Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>
1 parent 1f88560 commit 4b5ca3d

11 files changed

Lines changed: 45 additions & 45 deletions

File tree

r/R/csv.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@
6363
#' parsing options provided in other arguments (e.g. `delim`, `quote`, etc.).
6464
#' @param convert_options see [csv_convert_options()]
6565
#' @param read_options see [csv_read_options()]
66-
#' @param as_tibble Should the function return a `data.frame` or an
66+
#' @param as_data_frame Should the function return a `data.frame` or an
6767
#' [arrow::Table][Table]?
6868
#'
69-
#' @return A `data.frame`, or an Table if `as_tibble = FALSE`.
69+
#' @return A `data.frame`, or an Table if `as_data_frame = FALSE`.
7070
#' @export
7171
#' @examples
7272
#' \donttest{
@@ -95,7 +95,7 @@ read_delim_arrow <- function(file,
9595
parse_options = NULL,
9696
convert_options = NULL,
9797
read_options = NULL,
98-
as_tibble = TRUE) {
98+
as_data_frame = TRUE) {
9999

100100
if (is.null(parse_options)) {
101101
parse_options <- readr_to_csv_parse_options(
@@ -124,7 +124,7 @@ read_delim_arrow <- function(file,
124124

125125
tab <- reader$Read()$select(!!enquo(col_select))
126126

127-
if (isTRUE(as_tibble)) {
127+
if (isTRUE(as_data_frame)) {
128128
tab <- as.data.frame(tab)
129129
}
130130

@@ -147,7 +147,7 @@ read_csv_arrow <- function(file,
147147
parse_options = NULL,
148148
convert_options = NULL,
149149
read_options = NULL,
150-
as_tibble = TRUE) {
150+
as_data_frame = TRUE) {
151151

152152
mc <- match.call()
153153
mc$delim <- ","
@@ -171,7 +171,7 @@ read_tsv_arrow <- function(file,
171171
parse_options = NULL,
172172
convert_options = NULL,
173173
read_options = NULL,
174-
as_tibble = TRUE) {
174+
as_data_frame = TRUE) {
175175

176176
mc <- match.call()
177177
mc$delim <- "\t"

r/R/feather.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ FeatherTableWriter$create <- function(stream) {
9696
#' @inheritParams read_delim_arrow
9797
#' @param ... additional parameters
9898
#'
99-
#' @return A `data.frame` if `as_tibble` is `TRUE` (the default), or an
99+
#' @return A `data.frame` if `as_data_frame` is `TRUE` (the default), or an
100100
#' [arrow::Table][Table] otherwise
101101
#'
102102
#' @export
@@ -112,7 +112,7 @@ FeatherTableWriter$create <- function(stream) {
112112
#' df <- read_feather(tf, col_select = starts_with("Sepal"))
113113
#' })
114114
#' }
115-
read_feather <- function(file, col_select = NULL, as_tibble = TRUE, ...) {
115+
read_feather <- function(file, col_select = NULL, as_data_frame = TRUE, ...) {
116116
reader <- FeatherTableReader$create(file, ...)
117117

118118
all_columns <- ipc___feather___TableReader__column_names(reader)
@@ -122,7 +122,7 @@ read_feather <- function(file, col_select = NULL, as_tibble = TRUE, ...) {
122122
}
123123

124124
out <- reader$Read(columns)
125-
if (isTRUE(as_tibble)) {
125+
if (isTRUE(as_data_frame)) {
126126
out <- as.data.frame(out)
127127
}
128128
out

r/R/json.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#' @inheritParams read_delim_arrow
2323
#' @param ... Additional options, passed to `json_table_reader()`
2424
#'
25-
#' @return A `data.frame`, or an Table if `as_tibble = FALSE`.
25+
#' @return A `data.frame`, or an Table if `as_data_frame = FALSE`.
2626
#' @export
2727
#' @examples
2828
#' \donttest{
@@ -37,10 +37,10 @@
3737
#' df <- read_json_arrow(tf)
3838
#' })
3939
#' }
40-
read_json_arrow <- function(file, col_select = NULL, as_tibble = TRUE, ...) {
40+
read_json_arrow <- function(file, col_select = NULL, as_data_frame = TRUE, ...) {
4141
tab <- json_table_reader(file, ...)$Read()$select(!!enquo(col_select))
4242

43-
if (isTRUE(as_tibble)) {
43+
if (isTRUE(as_data_frame)) {
4444
tab <- as.data.frame(tab)
4545
}
4646
tab

r/R/parquet.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#' @param props [ParquetReaderProperties]
2626
#' @param ... Additional arguments passed to `ParquetFileReader$create()`
2727
#'
28-
#' @return A [arrow::Table][Table], or a `data.frame` if `as_tibble` is
28+
#' @return A [arrow::Table][Table], or a `data.frame` if `as_data_frame` is
2929
#' `TRUE`.
3030
#' @examples
3131
#' \donttest{
@@ -35,13 +35,13 @@
3535
#' @export
3636
read_parquet <- function(file,
3737
col_select = NULL,
38-
as_tibble = TRUE,
38+
as_data_frame = TRUE,
3939
props = ParquetReaderProperties$create(),
4040
...) {
4141
reader <- ParquetFileReader$create(file, props = props, ...)
4242
tab <- reader$ReadTable(!!enquo(col_select))
4343

44-
if (as_tibble) {
44+
if (as_data_frame) {
4545
tab <- as.data.frame(tab)
4646
}
4747
tab

r/man/read_delim_arrow.Rd

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r/man/read_feather.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r/man/read_json_arrow.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r/man/read_parquet.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r/tests/testthat/test-csv.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ test_that("Can read csv file", {
2323

2424
write.csv(iris, tf, row.names = FALSE)
2525

26-
tab1 <- read_csv_arrow(tf, as_tibble = FALSE)
27-
tab2 <- read_csv_arrow(mmap_open(tf), as_tibble = FALSE)
28-
tab3 <- read_csv_arrow(ReadableFile$create(tf), as_tibble = FALSE)
26+
tab1 <- read_csv_arrow(tf, as_data_frame = FALSE)
27+
tab2 <- read_csv_arrow(mmap_open(tf), as_data_frame = FALSE)
28+
tab3 <- read_csv_arrow(ReadableFile$create(tf), as_data_frame = FALSE)
2929

3030
iris$Species <- as.character(iris$Species)
3131
tab0 <- Table$create(!!!iris)
@@ -34,15 +34,15 @@ test_that("Can read csv file", {
3434
expect_equal(tab0, tab3)
3535
})
3636

37-
test_that("read_csv_arrow(as_tibble=TRUE)", {
37+
test_that("read_csv_arrow(as_data_frame=TRUE)", {
3838
tf <- tempfile()
3939
on.exit(unlink(tf))
4040

4141
write.csv(iris, tf, row.names = FALSE)
4242

43-
tab1 <- read_csv_arrow(tf, as_tibble = TRUE)
44-
tab2 <- read_csv_arrow(mmap_open(tf), as_tibble = TRUE)
45-
tab3 <- read_csv_arrow(ReadableFile$create(tf), as_tibble = TRUE)
43+
tab1 <- read_csv_arrow(tf, as_data_frame = TRUE)
44+
tab2 <- read_csv_arrow(mmap_open(tf), as_data_frame = TRUE)
45+
tab3 <- read_csv_arrow(ReadableFile$create(tf), as_data_frame = TRUE)
4646

4747
iris$Species <- as.character(iris$Species)
4848
expect_equivalent(iris, tab1)
@@ -170,9 +170,9 @@ test_that("read_csv_arrow() respects col_select", {
170170

171171
write.csv(iris, tf, row.names = FALSE, quote = FALSE)
172172

173-
tab <- read_csv_arrow(tf, col_select = starts_with("Sepal"), as_tibble = FALSE)
173+
tab <- read_csv_arrow(tf, col_select = starts_with("Sepal"), as_data_frame = FALSE)
174174
expect_equal(tab, Table$create(Sepal.Length = iris$Sepal.Length, Sepal.Width = iris$Sepal.Width))
175175

176-
tib <- read_csv_arrow(tf, col_select = starts_with("Sepal"), as_tibble = TRUE)
176+
tib <- read_csv_arrow(tf, col_select = starts_with("Sepal"), as_data_frame = TRUE)
177177
expect_equal(tib, tibble::tibble(Sepal.Length = iris$Sepal.Length, Sepal.Width = iris$Sepal.Width))
178178
})

r/tests/testthat/test-feather.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ test_that("feather handles col_select = <tidyselect helper>", {
9494
})
9595

9696
test_that("feather read/write round trip", {
97-
tab1 <- read_feather(feather_file, as_tibble = FALSE)
97+
tab1 <- read_feather(feather_file, as_data_frame = FALSE)
9898
expect_is(tab1, "Table")
9999

100100
expect_equal(tib, as.data.frame(tab1))

0 commit comments

Comments
 (0)