[Rd] write function (PR#10953)

Duncan Murdoch murdoch at stats.uwo.ca
Fri Mar 14 15:46:46 CET 2008


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



More information about the R-devel mailing list