Skip to content

export vector with write() introduces line breaks

2 messages · Martin Batholdy, Bert Gunter

#
Hi,

I have a long vector which I want to export as a simple ascii text file via
write(1:600, file='test.txt', sep=',')

When I open the text file with my text editor I see that the data is structured in columns.
So it seems that line breaks are introduced.

How can I prevent this?


Thank you!
#
1. Read ?write carefully. Note what it says about write() writing to
columns and the link to cat().

2. Use cat() with appropriate arguments to write your file instead.

e.g.

cat(1:600, file=yourfile,fill=FALSE)

Cheers,
Bert

On Sat, Nov 16, 2013 at 11:20 AM, Martin Batholdy
<batholdy at googlemail.com> wrote: