-
Notifications
You must be signed in to change notification settings - Fork 288
Description
I am trying to read a text file into R, that sometimes has quoted names in a rows and it only contains one column. This can look like the following:
first row
second "row"
"third" row
"fourth row"
If I try reading this file using the read_tsv()
function (because rows never contain tabs, but might contain commas), it reads it in the following way:
read_tsv("my_file.tsv",
col_names = FALSE,
show_col_types = FALSE,
progress = FALSE,
quote = "")
# A tibble: 4 x 1
X1
<chr>
1 "first row"
2 "second \"row\""
3 "third row"
4 "fourth row"
What I would expect from the argument quote = ""
is however, that it would keep and escape all the quotes.
If I use the function read_delim()
this is done correctly:
read_delim("my_file.tsv",
delim = "\t",
col_names = FALSE,
show_col_types = FALSE,
progress = FALSE,
quote = "")
X1
<chr>
1 "first row"
2 "second \"row\""
3 "\"third\" row"
4 "\"fourth row\" "
It seems to me that the quote
argument does not do anything when used in the read_tsv()
function as compared to the read_delim()
function. Maybe I made a mistake here and this is expected, but to me this does not seem as it is intended.
Help would be greatly appreciated!