From hilmar.berger at imise.uni-leipzig.de  Fri Mar 14 15:45:40 2008
From: hilmar.berger at imise.uni-leipzig.de (Hilmar Berger)
Date: Fri, 14 Mar 2008 15:45:40 +0100
Subject: [Rd] write function (PR#10953)
In-Reply-To: <20080314104505.DFB9B282EFF6@mail.pubhealth.ku.dk>
References: <20080314104505.DFB9B282EFF6@mail.pubhealth.ku.dk>
Message-ID: <fre319$jfm$1@ger.gmane.org>

Hi Alexander,

from the Help page of write:


Usage
write(x, file = "data",
       ncolumns = if(is.character(x)) 1 else 5,
       append = FALSE, sep = " ")

Arguments

x the data to be written out.
file A connection, or a character string naming the file to write to. If 
"", print to the standard output connection.

ncolumns the number of columns to write the data in.

append if TRUE the data x are appended to the connection.
sep a string used to separate columns. Using sep = "\t" gives tab 
delimited output; default is " ".


So, set ncolumns to 1 for a one-column file. No bug AFAIKS.

Regards,
Hilmar



efremov at mpiz-koeln.mpg.de schrieb:
> 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.
> Best regards,
> Alexander
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] write function (PR#10953)
Hilmar Berger