[R] export vector with write() introduces line breaks

Bert Gunter gunter.berton at gene.com
Sat Nov 16 20:30:51 CET 2013


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



More information about the R-help mailing list