[R] write table and dinnames

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Nov 4 16:12:52 CET 2002


>From ?write.table

     Normally there is no column name for a column of row names.  If
     `col.names=NA' a blank column name is added.  This can be used to
     write CSV files for input to spreadsheets.

See also the `R Data Import/Export Manual', as it is in in there too.


On Mon, 4 Nov 2002 AlessandroSemeria at cramont.it wrote:

> I would write in tab-text file a table like this one:
>
> TAB  colname1 TAB   colname2  TAB   TAB...         colnameN
> rowname1  #    #              #
> rowname2  #    #              #
>
>
> rownameM  #    #              #
>
> then I wrote something like:
>      mymatrix <- matrix(nrow=M,ncol=N,byrow=T)
>      rownames(mymatrix) <- chvector1
>      colnames(mymatrix) <- chvector2
>      write.table(mymatrix,file=myfile,sep="\t").
>
> But I obtained:
>
>
> colname1 TAB   colname2  TAB   TAB...         colnameN
> rowname1  #    #              #
> rowname2  #    #              #
>
>
> rownameM  #    #              #
>
> How to put in first column a TAB ("\t")?

I believe rather you want a blank column before the TAB which separates
columns.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list