rwrite.table

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?


Solution

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

    You can use the quote parameter.