简体   繁体   中英

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?

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

您可以使用quote参数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM