Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions r/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ 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,
glue,
R6,
vctrs (>= 0.1.0),
fs,
tibble,
crayon,
bit64
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
Suggests:
tibble,
covr,
pkgdown,
rmarkdown,
Expand Down Expand Up @@ -73,6 +73,5 @@ Collate:
'read_record_batch.R'
'read_table.R'
'reexports-bit64.R'
'reexports-tibble.R'
'write_arrow.R'
'zzz.R'
6 changes: 2 additions & 4 deletions r/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -109,7 +109,6 @@ export(TimeUnit)
export(Type)
export(array)
export(arrow_available)
export(as_tibble)
export(boolean)
export(buffer)
export(cast_options)
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion r/R/RecordBatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion r/R/Table.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion r/R/feather.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion r/R/parquet.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion r/R/read_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
20 changes: 0 additions & 20 deletions r/R/reexports-tibble.R

This file was deleted.

5 changes: 1 addition & 4 deletions r/man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions r/tests/testthat/test-RecordBatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
10 changes: 5 additions & 5 deletions r/tests/testthat/test-Table.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ 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)
tab <- table(!!!batches)
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))
)
})

Expand All @@ -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])
Expand Down
8 changes: 5 additions & 3 deletions r/tests/testthat/test-feather.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ test_that("feather handles columns = <names>", {
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)
})
Expand All @@ -87,7 +88,8 @@ test_that("feather handles columns = <integer>", {
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)
})

Expand All @@ -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)
})

Expand Down
2 changes: 1 addition & 1 deletion r/tests/testthat/test-parquet.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down