Skip to content

Commit

Permalink
chore: Avoid dplyr
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Mar 30, 2024
1 parent 8275312 commit 079e454
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Suggests:
constructive,
debugme,
devtools,
dplyr,
knitr,
lintr,
pkgload,
Expand Down
12 changes: 2 additions & 10 deletions R/spec-arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,15 @@ spec_arrow <- c(
utils::globalVariables("select")

stream_frame <- function(..., .select = NULL) {
if (!is_installed("dplyr")) {
skip("dplyr is not installed")
}

data <- data.frame(..., stringsAsFactors = FALSE, check.names = FALSE)
as_is <- map_lgl(data, inherits, "AsIs")
data[as_is] <- map(data[as_is], function(.x) {
class(.x) <- setdiff(class(.x), "AsIs")
.x
})

select <- enquo(.select)

if (!quo_is_null(select)) {
data <-
data %>%
dplyr::select(!!select)
if (!is.null(.select)) {
data <- data[.select]
}

out <- nanoarrow::as_nanoarrow_array_stream(data)
Expand Down

0 comments on commit 079e454

Please sign in to comment.