Kyla Celine Marcaida
Kyla Celine Marcaida

Reputation: 81

R - How to remove double quotes (" ") in the string values of write.table(... .txt) output?

Suppose I have the following dataset, dat:

     Name   Account No. Occupation
     Marie  7672        Nurse
     Jerry  0986        Veterinarian
     Max    3927        Hairdresser

I output a dataset, named "dat" using the following codes:

write.table(dat, file = paste(date, 'output.txt'), na ="", row.names = FALSE, append = TRUE, sep = '\t')

output.txt looks like

     "Name"     "Account No."    "Occupation"
     "Marie"    7672    "Nurse"
     "Jerry"    0986    "Veterinarian"
     "Max"    3927    "Hairdresser"

How do I remove the double quotes in the final output?

Upvotes: 1

Views: 3637

Answers (1)

Harshal Parekh
Harshal Parekh

Reputation: 6027

write.table(dat, file=paste(date, 'output.txt'), na ="", row.names=FALSE, append=TRUE, sep='\t', quote=FALSE)

You can use the quote parameter.

Upvotes: 4

Related Questions