Dear all, I am new to R and I am familiar with very basic stuff. I am trying to create tables in text format from each row of my table and export these tables with specific attribute in the table. I tried after reading some forums but nothing worked. Can you please help me. ex: dataGT ID State Year Growth 1 IA 1999 25 2 IA 2000 27 3 KS 1999 35 4 KS 2000 31 5 KY 1999 14 6 KY 2000 18 7 NE 1999 34 8 NE 2000 38 I am trying to have each row of the table as new table and need to export that table with name of of the ID. Please help me if possible. Thank you Kalyani -- View this message in context: http://r.789695.n4.nabble.com/Exporting-each-row-in-the-table-as-new-table-tp4645844.html Sent from the R help mailing list archive at Nabble.com.
R. Michael Weylandt
2012-Oct-11 13:56 UTC
[R] Exporting each row in the table as new table
On Thu, Oct 11, 2012 at 2:04 PM, kallu <kallut80 at gmail.com> wrote:> Dear all, > > I am new to R and I am familiar with very basic stuff. I am trying to create > tables in text format from each row of my table and export these tables with > specific attribute in the table. I tried after reading some forums but > nothing worked. Can you please help me. > > ex: > dataGT > > ID State Year Growth > 1 IA 1999 25 > 2 IA 2000 27 > 3 KS 1999 35 > 4 KS 2000 31 > 5 KY 1999 14 > 6 KY 2000 18 > 7 NE 1999 34 > 8 NE 2000 38 > > I am trying to have each row of the table as new table and need to export > that table with name of of the ID. > > Please help me if possible. Thank you > Kalyani > >Hi Kalyani, I'm afraid I don't understand your question: what do you mean in this context by "table"? data frame()s? csv files? And in either case, why are you splitting into single row objects? When you say "attribute" do you mean the formal programming construct that is key to many things in R or something simpler? In short, could you elaborate further? Finally, I note you're posting from Nabble. Please include context in your reply -- I don't believe Nabble does this automatically, so you'll need to manually include it. Most of the regular respondents on this list don't use Nabble -- it is a _mailing list_ after all -- so we don't get the forum view you do, only emails of the individual posts. Combine that with the high volume of posts, and it's quite difficult to trace a discussion if we all don't make sure to include context. This might also be of help: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Cheers, Michael
Hi> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of kallu > Sent: Thursday, October 11, 2012 3:05 PM > To: r-help at r-project.org > Subject: [R] Exporting each row in the table as new table > > Dear all, > > I am new to R and I am familiar with very basic stuff. I am trying to > create tables in text format from each row of my table and export these > tables with specific attribute in the table. I tried after reading some > forums but nothing worked. Can you please help me. > > ex: > dataGT > > ID State Year Growth > 1 IA 1999 25 > 2 IA 2000 27 > 3 KS 1999 35 > 4 KS 2000 31 > 5 KY 1999 14 > 6 KY 2000 18 > 7 NE 1999 34 > 8 NE 2000 38 > > I am trying to have each row of the table as new table and need to > export that table with name of of the ID. > > Please help me if possible. Thank you > KalyaniWell, be more specific. How do you want the output by formated based on above example. From what you say it seems to me that you want split(dataGT, dataGT$id) but cut me into pieces if I know why. Regards Petr> > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Exporting- > each-row-in-the-table-as-new-table-tp4645844.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.