Skip to content

write_tsv adds quotes to tibble column with double quotations #854

@ChiWPak

Description

@ChiWPak

I'm encountering a similar issue as posted on stackoverflow in Feb 2018 - it has no solutions

https://stackoverflow.com/questions/48694547/using-readr-to-read-tsv-where-some-fields-have-quotes-after-writing-back-out-t

A string-column containing double quotations is printed out to file with an extra set of quotes around the entire string when using write_tsv (I can't tell if this is because of tibble or write_tsv)

A reproducible example with comparison to write.table

options(useFancyQuotes = FALSE)
df <- data.frame(A = paste("val is", dQuote("ok")))
out1 <- "readr_out.tsv"
out2 <- "baser_out.tsv" 
write_tsv(df, out1, col_names=FALSE)
# "val is ""ok""" 
write.table(df, out2, sep = '\t', quote = FALSE, row.names = FALSE, col.names=FALSE)
# val is "ok"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions