use append = TRUE inside your write.xlsx() function
On Thu, Dec 13, 2012 at 7:52 AM, Tammy Ma <metal_lical...@live.com> wrote: > > HI, > > > I have large dataset of many countries. I have written the program to run > through each country to generate one output for each country. I want to put > the output like this: > > one sheet has output for one country. How do I achieve it by r. > > I have tried this: > library(xlsx) > write.xlsx(nnn, "vn.xlsx", sheetName="Sheet1") [1] > > but when I change sheetName="Sheet2" to add up another country into one > sheet. it autimatically deleted which I have down on [1]. > > index<-unique(dataset$country) > for (i in 1:length(index)){ > > data<-dataset[dataset$country==index[i],] > (...) > output<-dd > #then how do I create each country's output into one sheet of one excel??? > > } > > > Kind regards, > Tammy > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.