Skip to content
Back to formatted view

Raw Message

Message-ID: <CACk-te3seZLHEaTwc5VgurB=K7dVNS8u8qcCf63SMq6xQRvN2w@mail.gmail.com>
Date: 2013-11-16T19:30:51Z
From: Bert Gunter
Subject: export vector with write() introduces line breaks
In-Reply-To: <3FC1DBA3-2908-4487-BC15-FBB49640D9DF@googlemail.com>

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:
> 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!
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

(650) 467-7374