| To: | "Thompson, Trevor" <tkt2@cdc.gov> |
|---|---|
| Subject: | Re: Exporting to Excel spreadsheet with multiple worksheets |
| From: | Pravin Jadhav <pravinj@gmail.com> |
| Date: | Wed, 13 Apr 2005 21:52:47 -0400 |
| Cc: | s-news@lists.biostat.wustl.edu |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=JqavXX2PTRNHRx2VUrCNYiSuTEl6mLENia11jaNLE7b3ETTkG1KdfSziLLU6FFNishCRA+97cmkU9iuoD2PlNAlLwuhpmlbJa3xmrjjm8rDclwgDaqK6D+PxD9B0pSfuMRhZMOXstZW95dwOdMTUkQfjcPTek5UDmxw6H3PrgoY= |
| In-reply-to: | <0C99138EC3C40844B541919DD84C28B6034A2C4A@m-nccd-3.nccd.cdc.gov> |
| References: | <0C99138EC3C40844B541919DD84C28B6034A2C4A@m-nccd-3.nccd.cdc.gov> |
| Reply-to: | Pravin Jadhav <pravinj@gmail.com> |
|
here are some messages that I received to a similar query.
MESSAGE 1
---------- Forwarded message ----------
From: Austin, Matt <maustin@amgen.com> Date: Dec 2, 2004 4:55 PM Subject: RE: [S] Importing a lot of Excel Worksheets into a data frame To: Pravin Jadhav <pravinj@gmail.com> Here is a section of code that might be helpful, the first section reads all the pages into a list of dataframes and adds a column that specifies the page by number to each dataframe. The the do.call functoin concatenates it all together. schoolData <- lapply(1:8, function(x) data.frame(Page=x, importData("c:/data_mirror/ElementaryMathFall041.xls", page=x, stringsAsFactors=FALSE))) school.df <- do.call('rbind', schoolData) Matt Austin Statistician MESSAGE 2
---------- Forwarded message ----------
From: Biggerstaff, Brad J. <BKB5@cdc.gov> Date: Dec 2, 2004 5:07 PM Subject: RE: [S] Importing a lot of Excel Worksheets into a data frame To: Pravin Jadhav <pravinj@gmail.com> Perhaps not pretty, but if you know the number of pages, you can use importData with a for loop: > x.dat <- importData(file="c:/TestImport.xls",type="excel",pageNumber=1) > for(i in 2:2) x.dat <- rbind(x.dat,importData(file="c:/TestImport.xls",type="excel",pageNumber= i)) where there are just 2 pages here. This does assume the worksheets are, as you say, "the same"...as is the example workbook I include. Cheers, Brad Brad Biggerstaff, Ph.D . (970) 221-6473 ... BBiggerstaff@cdc.gov MESSAGE 3
---------- Forwarded message ---------- From: Molinari, Luciano <Luciano.Molinari@kispi.unizh.ch > Date: Dec 3, 2004 4:48 AM Subject: RE: [S] Importing a lot of Excel Worksheets into a data frame To: Pravin Jadhav <pravinj@gmail.com> SPLUS2K under W2K Select: File/Import Data/From File/ Then the Option submenu allows to select the page. Alternatively, working from the command window, the function import.data has an undocumented parameter "PageNumber" which allows to input different Excel work sheets, which can then be combined into a a single data frame. You can try both ways on the attached Excel file XY. From the command window: import.data(DataFrame="zz1",FileName=" XY.xls",FileT="EXCEL",PageNumber=1) import.data(DataFrame="zz2",FileName="XY.xls",FileT="EXCEL",PageNumber=2) Hope this helps, L. Molinari On 4/13/05, Thompson, Trevor <tkt2@cdc.gov> wrote:
Hi, -- Pravin Jadhav Graduate Student Department of Pharmaceutics MCV/Virginia Commonwealth University DPE1/OCPB/CDER/Food and Drug Administration Phone: (301) 594-5652 Fax: (301) 480-3212 /_/_/_/_ If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas. --George Bernard Shaw |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Exporting to Excel spreadsheet with multiple worksheets, Thompson, Trevor |
|---|---|
| Next by Date: | Re: Data Manipulation for SAS User, Wim Kimmerer |
| Previous by Thread: | Exporting to Excel spreadsheet with multiple worksheets, Thompson, Trevor |
| Next by Thread: | Re: Exporting to Excel spreadsheet with multiple worksheets, Thompson, Trevor |
| Indexes: | [Date] [Thread] [Top] [All Lists] |