From murdoch at stats.uwo.ca  Fri Mar 14 15:46:46 2008
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Fri, 14 Mar 2008 10:46:46 -0400
Subject: [Rd] write function (PR#10953)
In-Reply-To: <20080314104505.DFB9B282EFF6@mail.pubhealth.ku.dk>
References: <20080314104505.DFB9B282EFF6@mail.pubhealth.ku.dk>
Message-ID: <47DA8FD6.3020700@stats.uwo.ca>

On 3/14/2008 6:45 AM, efremov at mpiz-koeln.mpg.de wrote:
> Full_Name: Alexander Yephremov
> Version: R 2.6.2 GUI 1.23 (4932) (4932)
> OS: Mac OS X 10.4 
> Submission from: (NULL) (193.174.239.91)
> 
> 
> Hi!
> 
>> array <- 0*1:50
>> array
>  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0
>> write(array, "array.file", sep=",")
> 
> This is how array.file looks:
> 
> 0,0,0,0,0
> 0,0,0,0,0
> 0,0,0,0,0
> 0,0,0,0,0
> 0,0,0,0,0
> 0,0,0,0,0
> 0,0,0,0,0
> 0,0,0,0,0
> 0,0,0,0,0
> 0,0,0,0,0
> 
> As you see, the resulting array.file is organized in 5 columns although, I think
> there must be a vector. It is the same with any sep.

I don't see a bug.  This is pretty clearly behaving as documented.  By 
default, it sets ncolumns to 5 for non-character data.

If you want it all on one line, set ncolumns to length(array).

Duncan Murdoch



[Rd] write function (PR#10953)
Duncan Murdoch