Tabs are not trimmed when trim_ws = TRUE #767
Closed
Labels
Comments
Could you please turn this into a reprex so we can be sure we're troubleshooting the exact same thing? Thanks |
Here it is. I hope I've done it correctly. library(readr)
csv_file <- "X,Y\nx1\t,y1\nx2,y2\t\nx3 ,y3 \n"
data <- read_csv(csv_file, trim_ws = TRUE, col_types = "cc")
data[, 1]
#> # A tibble: 3 x 1
#> X
#> <chr>
#> 1 "x1\t"
#> 2 x2
#> 3 x3
data[, 2]
#> # A tibble: 3 x 1
#> Y
#> <chr>
#> 1 y1
#> 2 "y2\t"
#> 3 y3 |
(bump) this bug seems to be still there and left open, are you able to reproduce it using the reprex above? |
Thanks for the fix @jimhester . But it seems to only handle the space and tab characters and not "whitespace" in general. Wouldn't it better to capture white space using |
No. |
Thanks for your extensive explanation :) |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When using
read_csv
to read a CSV file that contains tabs on its rows, thetrim_ws
argument does not seem to have any effect. The tab characters do not get stripped anyway.Take this CSV file for example
There is a tab after
x2
and aftery3
(not visible). And the code below demonstrates the issueAs you can see the tab characters are there and not trimmed.
I'm running the code using R 3.3.3 and readr 1.1.1. on macOS High Sierra.
The text was updated successfully, but these errors were encountered: