Skip to content

Commit

Permalink
Correctly pass all arguments in read_tsv
Browse files Browse the repository at this point in the history
Fixes #1254
Fixes #1255
  • Loading branch information
jimhester committed Jul 30, 2021
1 parent bf34a35 commit 65c85bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# readr (development version)

* `read_tsv()` now correctly passes the `quote` and `na` arguments to `vroom::vroom()` (#1254, #1255)

* `options(readr.show_col_types = FALSE)` now works as intended (#1250)

* Avoid spurious byte compilation errors due to the programatically generated `spec_*()` functions.
Expand Down
10 changes: 7 additions & 3 deletions R/read_delim.R
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,19 @@ read_tsv <- function(file, col_names = TRUE, col_types = NULL,
col_select = {{ col_select }},
id = id,
.name_repair = name_repair,
locale = locale,
skip = skip,
n_max = n_max,
na = na,
quote = quote,
comment = comment,
skip_empty_rows = skip_empty_rows,
trim_ws = trim_ws,
n_max = n_max,
escape_double = FALSE,
escape_backslash = TRUE,
locale = locale,
guess_max = guess_max,
progress = progress,
show_col_types = show_col_types,
progress = progress,
altrep = lazy,
num_threads = num_threads
)
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-read-csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,10 @@ test_that("read_csv works with single quotes in skipped lines (#945)", {
expect_equal(nrow(x), 1)
expect_equal(ncol(x), 5)
})

test_that("read_tsv correctly uses the quote and na arguments (#1254, #1255)", {
x <- read_tsv(I("foo\tbar\n\"one baz\"\ttwo\nthree\t\n"), quote = "", na = character())

exepct_equal(x[[1]], c("\"one baz\"", "three"))
exepct_equal(x[[2]], c("two", ""))
})

1 comment on commit 65c85bf

@alyst
Copy link
Contributor

@alyst alyst commented on 65c85bf Aug 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing it. Are there any plans to release 2.0.1 soon?
The problem with na= causes misidentification of column types, which leads to a huge breakage in my scripts.

Please sign in to comment.