Skip to content

Commit

Permalink
Update read_file.R
Browse files Browse the repository at this point in the history
  • Loading branch information
Moohan authored Jul 25, 2024
1 parent 4ba468a commit eb17e6e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions R/read_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' @param ... Addition arguments passed to the relevant function.
#'
#' @return the data a [tibble][tibble::tibble-package]
read_file <- function(path, col_select = NULL, as_data_frame = TRUE, ...) {
read_file <- function(path, col_select = NULL, ...) {
valid_extensions <- c(
"rds",
"csv",
Expand All @@ -29,7 +29,7 @@ read_file <- function(path, col_select = NULL, as_data_frame = TRUE, ...) {
))
}

if ((!missing(col_select) || !missing(as_data_frame)) && ext != "parquet") {
if ((!missing(col_select) && ext != "parquet") {
cli::cli_abort(c(
"x" = "{.arg col_select} and/or {.arg as_data_frame} must only be used
when reading a {.field .parquet} file."
Expand All @@ -42,7 +42,6 @@ read_file <- function(path, col_select = NULL, as_data_frame = TRUE, ...) {
"parquet" = tibble::as_tibble(arrow::read_parquet(
file = path,
col_select = !!col_select,
as_data_frame = as_data_frame,
...
))
)
Expand Down

0 comments on commit eb17e6e

Please sign in to comment.