I have a command: write.table(table_list, file= paste("file", x, sep = "")) where x is the file name. How do I convert this file into a csv file in this statement? -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543232.html Sent from the R help mailing list archive at Nabble.com.
On Sep 16, 2010, at 9:49 PM, lord12 wrote:> > I have a command: > write.table(table_list, file= paste("file", x, sep = "")) where x is > the > file name. How do I convert this file into a csv file in this > statement?By using a sep argument of "," for write.table or using the pre- packaged write.csv(), which will choose appropriate defaults for csv files but is really only a call to write.table().> -- > View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543232.html > Sent from the R help mailing list archive at Nabble.com.-- David Winsemius, MD West Hartford, CT
write.table(table_list, file= paste("file", x, sep = ""), sep = ",") My output is still a file object. -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543251.html Sent from the R help mailing list archive at Nabble.com.
I want to open the file in excel and I want the columns in my table to be lined up with the columns in excel. -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543256.html Sent from the R help mailing list archive at Nabble.com.
On Sep 16, 2010, at 10:22 PM, lord12 wrote:> > I want to open the file in excel and I want the columns in my table > to be > lined up with the columns in excel.Generally one would use an extension of .csv in that instance, and you may need to move the column headers over one cell because the "blank cell" at the upper left corner of the table does not get written by write.table.> -- > View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543256.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org 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.David Winsemius, MD West Hartford, CT
In order to use the extension csv, is the syntax: write.table(table_list, file= paste("file", x, sep = "").csv, sep = ",") ? Also I pretty much create a table by doing: table_list= cbind(c1,c2,c3,c4) where c1...c4 are vectors. -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543277.html Sent from the R help mailing list archive at Nabble.com.
no. Your best way is to use write.csv(table_list, file = paste("file", x, ".csv", sep="")) -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of lord12 Sent: Friday, 17 September 2010 12:55 PM To: r-help at r-project.org Subject: Re: [R] convert to csv file In order to use the extension csv, is the syntax: write.table(table_list, file= paste("file", x, sep = "").csv, sep = ",") ? Also I pretty much create a table by doing: table_list= cbind(c1,c2,c3,c4) where c1...c4 are vectors. -- View this message in context: http://r.789695.n4.nabble.com/convert-to-csv-file-tp2543232p2543277.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org 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.