Try the function sqlFetch to import the data in the spreadsheet.
jo<-odbcConnectExcel("i:\\all\\sorkinjohn\\stats\\silvermannatalie\\NEMOcomb
ined06-24-09.xls",readOnly = TRUE)
mo<-sqlFetch(jo,'Your Sheet Name or Number',colnames=F,rownames=F)
mo
Hope it helps.
-------------------------------------------------------------
MSc. Rodrigo Aluizio
Centro de Estudos do Mar/UFPR
Laborat?rio de Micropaleontologia
Avenida?Beira Mar s/n - CEP 83255-000
Pontal do Paran? - PR - Brasil
-----Mensagem original-----
De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Em
nome de John Sorkin
Enviada em: quinta-feira, 25 de junho de 2009 08:21
Para: r-help at r-project.org
Assunto: [R] RODBC: Trying to read an Excel file
R 2.8
Windows XP
Excel 2003
I am trying to read an Excel spread sheet. I have looked at the RODBC help
pages and am having trouble setting up code that will work. My code and the
results are pasted below:
>
jo<-odbcConnectExcel("i:\\all\\sorkinjohn\\stats\\silvermannatalie\\NEMOcomb
ined06-24-09.xls",readOnly = TRUE)> mo<-sqlGetResults(jo)
> mo
[1] -1
I have tried to set up the connection string using odbcConnectExcel and then
have tried to read the file using sqlGetResults. Can someone tell me what I
am doing wrong?
Thanks,
John
John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:9}}