Tinniam V. Ganesh
Tinniam V. Ganesh

Reputation: 2077

Writing to a file in R prints on 2 lines

I am writing a vector to a file in R. However the output comes on 2 lines. I wanted all the values to come on a single line. Can you let me know how to fix this

write(value,file=fileconn,append=TRUE,sep="\t")

The o/p comes as follows

1777.167 1825.167 1873.167 1921.167 1969.167

2017.167

Regards Ganesh

Upvotes: 0

Views: 54

Answers (1)

MrFlick
MrFlick

Reputation: 206232

I'm not sure write() is probably not the best choice, but if you want to use it, it might be a good idea to check the ?write help file. It does have an ncolumns= parameter which defaults to 5 for simple numeric vectors.

I would think cat() would be a better solution for just dumping numeric vectors.

Upvotes: 2

Related Questions