Skip to content

Commit

Permalink
fix: Skip test if dplyr is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Oct 8, 2023
1 parent bdab15a commit 9e48674
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ importFrom(rlang,eval_tidy)
importFrom(rlang,expr)
importFrom(rlang,global_env)
importFrom(rlang,has_length)
importFrom(rlang,is_installed)
importFrom(rlang,is_interactive)
importFrom(rlang,is_logical)
importFrom(rlang,list2)
importFrom(rlang,local_options)
importFrom(rlang,quo)
importFrom(rlang,quo_is_null)
importFrom(rlang,seq2)
importFrom(rlang,set_names)
importFrom(stats,setNames)
Expand Down
2 changes: 1 addition & 1 deletion R/import-testthat.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' @import testthat
#' @importFrom rlang quo enquo enquos expr enexpr eval_tidy list2 has_length :=
#' @importFrom rlang abort is_interactive as_function local_options seq2 set_names
#' @importFrom rlang %||% global_env is_logical
#' @importFrom rlang %||% global_env is_logical is_installed quo_is_null
NULL

#' @importFrom methods findMethod getClasses getClass extends
Expand Down
12 changes: 10 additions & 2 deletions R/spec-arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ spec_arrow <- c(
NULL
)

utils::globalVariables("select")

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

data <- data.frame(..., stringsAsFactors = FALSE)

if (!is.null(.select)) {
select <- enquo(.select)

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

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

0 comments on commit 9e48674

Please sign in to comment.