diff --git a/r/DESCRIPTION b/r/DESCRIPTION index d566f74856b..bfcece29a07 100644 --- a/r/DESCRIPTION +++ b/r/DESCRIPTION @@ -21,9 +21,9 @@ Encoding: UTF-8 LazyData: true SystemRequirements: C++11 LinkingTo: - Rcpp (>= 1.0.0) + Rcpp (>= 1.0.1) Imports: - Rcpp (>= 1.0.0), + Rcpp (>= 1.0.1), rlang, purrr, assertthat, @@ -31,12 +31,12 @@ Imports: R6, vctrs (>= 0.1.0), fs, - tibble, crayon, bit64 Roxygen: list(markdown = TRUE) RoxygenNote: 6.1.1 Suggests: + tibble, covr, pkgdown, rmarkdown, @@ -73,6 +73,5 @@ Collate: 'read_record_batch.R' 'read_table.R' 'reexports-bit64.R' - 'reexports-tibble.R' 'write_arrow.R' 'zzz.R' diff --git a/r/NAMESPACE b/r/NAMESPACE index bc4f677cc00..86fa419fc7c 100644 --- a/r/NAMESPACE +++ b/r/NAMESPACE @@ -38,8 +38,8 @@ S3method(RecordBatchStreamReader,raw) S3method(RecordBatchStreamWriter,"arrow::io::OutputStream") S3method(RecordBatchStreamWriter,character) S3method(RecordBatchStreamWriter,fs_path) -S3method(as_tibble,"arrow::RecordBatch") -S3method(as_tibble,"arrow::Table") +S3method(as.data.frame,"arrow::RecordBatch") +S3method(as.data.frame,"arrow::Table") S3method(buffer,"arrow::Buffer") S3method(buffer,complex) S3method(buffer,default) @@ -109,7 +109,6 @@ export(TimeUnit) export(Type) export(array) export(arrow_available) -export(as_tibble) export(boolean) export(buffer) export(cast_options) @@ -174,5 +173,4 @@ importFrom(rlang,abort) importFrom(rlang,dots_n) importFrom(rlang,list2) importFrom(rlang,warn) -importFrom(tibble,as_tibble) useDynLib(arrow, .registration = TRUE) diff --git a/r/R/RecordBatch.R b/r/R/RecordBatch.R index 2b9148a8e3b..3ebd81b162e 100644 --- a/r/R/RecordBatch.R +++ b/r/R/RecordBatch.R @@ -85,7 +85,7 @@ } #' @export -`as_tibble.arrow::RecordBatch` <- function(x, use_threads = TRUE, ...){ +`as.data.frame.arrow::RecordBatch` <- function(x, row.names = NULL, optional = FALSE, use_threads = TRUE, ...){ RecordBatch__to_dataframe(x, use_threads = use_threads) } diff --git a/r/R/Table.R b/r/R/Table.R index 87e87ac0dba..4c434b0a3f3 100644 --- a/r/R/Table.R +++ b/r/R/Table.R @@ -66,7 +66,7 @@ table <- function(..., schema = NULL){ } #' @export -`as_tibble.arrow::Table` <- function(x, use_threads = TRUE, ...){ +`as.data.frame.arrow::Table` <- function(x, row.names = NULL, optional = FALSE, use_threads = TRUE, ...){ Table__to_dataframe(x, use_threads = use_threads) } diff --git a/r/R/feather.R b/r/R/feather.R index 4a1d9de0fa1..c65ea9ebdb1 100644 --- a/r/R/feather.R +++ b/r/R/feather.R @@ -169,7 +169,7 @@ FeatherTableReader.fs_path <- function(file, mmap = TRUE, ...) { read_feather <- function(file, columns = NULL, as_tibble = TRUE, use_threads = TRUE, ...){ out <- FeatherTableReader(file, ...)$Read(columns) if (isTRUE(as_tibble)) { - out <- as_tibble(out, use_threads = use_threads) + out <- as.data.frame(out, use_threads = use_threads) } out } diff --git a/r/R/parquet.R b/r/R/parquet.R index d7f389f679f..8caf356c8c0 100644 --- a/r/R/parquet.R +++ b/r/R/parquet.R @@ -39,7 +39,7 @@ read_parquet <- function(file, as_tibble = TRUE, use_threads = TRUE, ...) { tab <- shared_ptr(`arrow::Table`, read_parquet_file(file)) if (isTRUE(as_tibble)) { - tab <- as_tibble(tab, use_threads = use_threads) + tab <- as.data.frame(tab, use_threads = use_threads) } tab } diff --git a/r/R/read_table.R b/r/R/read_table.R index b4712967e66..f7a7987b3c3 100644 --- a/r/R/read_table.R +++ b/r/R/read_table.R @@ -86,5 +86,5 @@ read_table.fs_path <- function(stream) { #' @rdname read_table #' @export read_arrow <- function(stream, use_threads = TRUE){ - as_tibble(read_table(stream)) + as.data.frame(read_table(stream)) } diff --git a/r/R/reexports-tibble.R b/r/R/reexports-tibble.R deleted file mode 100644 index de445c243eb..00000000000 --- a/r/R/reexports-tibble.R +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -#' @importFrom tibble as_tibble -#' @export -tibble::as_tibble diff --git a/r/man/reexports.Rd b/r/man/reexports.Rd index 66194feadbf..6951fcf8cfd 100644 --- a/r/man/reexports.Rd +++ b/r/man/reexports.Rd @@ -1,11 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/reexports-bit64.R, R/reexports-tibble.R +% Please edit documentation in R/reexports-bit64.R \docType{import} \name{reexports} \alias{reexports} \alias{print.integer64} \alias{str.integer64} -\alias{as_tibble} \title{Objects exported from other packages} \keyword{internal} \description{ @@ -14,7 +13,5 @@ below to see their documentation. \describe{ \item{bit64}{\code{\link[bit64]{print.integer64}}, \code{\link[bit64]{str.integer64}}} - - \item{tibble}{\code{\link[tibble]{as_tibble}}} }} diff --git a/r/tests/testthat/test-RecordBatch.R b/r/tests/testthat/test-RecordBatch.R index c0295bac2c8..93d50d80496 100644 --- a/r/tests/testthat/test-RecordBatch.R +++ b/r/tests/testthat/test-RecordBatch.R @@ -75,13 +75,13 @@ test_that("RecordBatch", { schema(dbl = float64(), lgl = boolean(), chr = utf8(), fct = dictionary(int32(), array(letters[1:10]))) ) expect_equal(batch2$column(0), batch$column(1)) - expect_identical(as_tibble(batch2), tbl[,-1]) + expect_identical(as.data.frame(batch2), tbl[,-1]) batch3 <- batch$Slice(5) - expect_identical(as_tibble(batch3), tbl[6:10,]) + expect_identical(as.data.frame(batch3), tbl[6:10,]) batch4 <- batch$Slice(5, 2) - expect_identical(as_tibble(batch4), tbl[6:7,]) + expect_identical(as.data.frame(batch4), tbl[6:7,]) }) test_that("RecordBatch with 0 rows are supported", { diff --git a/r/tests/testthat/test-Table.R b/r/tests/testthat/test-Table.R index 59234fa5c01..56b096961f2 100644 --- a/r/tests/testthat/test-Table.R +++ b/r/tests/testthat/test-Table.R @@ -88,8 +88,8 @@ test_that("table() handles record batches with splicing", { expect_equal(tab$schema, batch$schema) expect_equal(tab$num_rows, 6L) expect_equal( - as_tibble(tab), - vctrs::vec_rbind(as_tibble(batch), as_tibble(batch), as_tibble(batch)) + as.data.frame(tab), + vctrs::vec_rbind(as.data.frame(batch), as.data.frame(batch), as.data.frame(batch)) ) batches <- list(batch, batch, batch) @@ -97,8 +97,8 @@ test_that("table() handles record batches with splicing", { expect_equal(tab$schema, batch$schema) expect_equal(tab$num_rows, 6L) expect_equal( - as_tibble(tab), - vctrs::vec_rbind(!!!purrr::map(batches, as_tibble)) + as.data.frame(tab), + vctrs::vec_rbind(!!!purrr::map(batches, as.data.frame)) ) }) @@ -113,7 +113,7 @@ test_that("table() handles ... of arrays, chunked arrays, vectors", { tab$schema, schema(a = int32(), b = int32(), c = float64(), x = int32(), y = utf8()) ) - res <- as_tibble(tab) + res <- as.data.frame(tab) expect_equal(names(res), c("a", "b", "c", "x", "y")) expect_equal(res, tibble::tibble(a = 1:10, b = 1:10, c = v, x = 1:10, y = letters[1:10]) diff --git a/r/tests/testthat/test-feather.R b/r/tests/testthat/test-feather.R index f97348cb2cb..6d874b30456 100644 --- a/r/tests/testthat/test-feather.R +++ b/r/tests/testthat/test-feather.R @@ -72,7 +72,8 @@ test_that("feather handles columns = ", { tab1 <- read_feather(tf1, columns = c("x", "y")) expect_is(tab1, "data.frame") - expect_equal(tib[, c("x", "y")], as_tibble(tab1)) + expect_equal(tib$x, tab1$x) + expect_equal(tib$y, tab1$y) unlink(tf1) }) @@ -87,7 +88,8 @@ test_that("feather handles columns = ", { tab1 <- read_feather(tf1, columns = 1:2) expect_is(tab1, "data.frame") - expect_equal(tib[, c("x", "y")], as_tibble(tab1)) + expect_equal(tib$x, tab1$x) + expect_equal(tib$y, tab1$y) unlink(tf1) }) @@ -101,7 +103,7 @@ test_that("feather read/write round trip", { tab1 <- read_feather(tf1, as_tibble = FALSE) expect_is(tab1, "arrow::Table") - expect_equal(tib, as_tibble(tab1)) + expect_equal(tib, as.data.frame(tab1)) unlink(tf1) }) diff --git a/r/tests/testthat/test-parquet.R b/r/tests/testthat/test-parquet.R index 81637f33956..f0a742da1d9 100644 --- a/r/tests/testthat/test-parquet.R +++ b/r/tests/testthat/test-parquet.R @@ -26,7 +26,7 @@ test_that("reading a known Parquet file to tibble", { # TODO: assert more about the contents }) -test_that("as_tibble with and without threads", { +test_that("as.data.frame with and without threads", { expect_identical( read_parquet(pq_file), read_parquet(pq_file, use_threads = FALSE)