[R] export table

Stephen Tucker brown_emu at yahoo.com
Thu Mar 22 06:27:06 CET 2007


You can also use 

write.table(y,"D:/Desktop/export_table.txt", col.names=NA)

with this function call, the row names get printed but the column names are
offset so that they are aligned in the right column.



--- Chuck Cleland <ccleland at optonline.net> wrote:

> Sergio Della Franca wrote:
> > Dear R-Helpers,
> > 
> > I have a problem.
> > 
> > I want to export from R to .txt my data set(y):
> > 
> > YEARS PRODUCTS
> > 1990     10
> > 1995     15
> > 1997     26
> > 1998     29
> > 2000     34
> > 
> > 
> > I used this code:
> > 
> > write.table(y,"D:/Desktop/export_table.txt").
> > 
> > This procedure run correctly, but i acquired this result:
> > 
> >  YEARS PRODUCTS
> > 1           1990     10
> > 2           1995     15
> > 3           1997     26
> > 4           1998     29
> > 5           2000     34
> > 
> > The prolem is that R add a column in the export procedure, but it doesn't
> > give a name at column then this new column get the name of the first
> column
> > of my data set.
> > 
> > There is a command that a must add to my export procedure to not export
> this
> > column or to give at this a name?
> 
> write.table(y,"D:/Desktop/export_table.txt", row.names=FALSE)
> 
>   The row.names and col.names arguments are described in the help page
> for write.table().
> 
> > Thank you in advance.
> > 
> > 
> > Sergio.
> > 
> > 	[[alternative HTML version deleted]]
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch 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.
> 
> -- 
> Chuck Cleland, Ph.D.
> NDRI, Inc.
> 71 West 23rd Street, 8th floor
> New York, NY 10010
> tel: (212) 845-4495 (Tu, Th)
> tel: (732) 512-0171 (M, W, F)
> fax: (917) 438-0894
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
> 



 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go



More information about the R-help mailing list