Hi, Hi,
Please find below my R code (in R) Portfolio=read.csv("Z:\\Internal\\R Files\\Portfolio.csv", header=T) > Benchmark=read.csv("Z:\\Internal\\R Files\\Benchmark.csv", header=T) > save.image("Z:\\Internal\\R Files\\sample") Saved as Sample.R Here's my VBA code: to read dataframe Portfolio and then print it into Excel. For some reason, it gives me the following error: It gives me an error "Run-time error 13- Type mismatch" and when I try to debug, it stops at line below in the RInterface Module. nrows = REvalReturn("dim(" & DFname & ")[1]") + 1. VBA Code: Private Sub CommandButton1_Click() Call RInterface.StartRServer Call RInterface.RRun("setwd(""Z:/Internal/R Files"")") ChDir "Z:/Internal/R Files" Call RInterface.RunRFile("sample.R") 'Call RInterface.GetDataframe("Portfolio", Range("Sheet1!A1")) Call RInterface.GetDataframe("data.frame(Portfolio)", Range("Sheet1!A1")) Call RInterface.StopRServer End Sub PS: I tried both Lines 6 and 7 (that I found in the mailing list) but both give the same error. I am using R (2.5.1) and RSrv200.exe. Regards, Uma -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Uma Sitaraman Sent: Wednesday, January 23, 2008 9:52 AM To: R (D)COM and RExcel server related issues Subject: RE: [Rcom-l] Read Excel data Hi, I tried that too. It still gives me the same error. Regards, Uma -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Erich Neuwirth Sent: Tuesday, January 22, 2008 7:05 AM To: R (D)COM and RExcel server related issues Subject: Re: [Rcom-l] Read Excel data Uma Sitaraman wrote: > Hi, > > > > I am new to both R and RDcom, and am stuck trying to read excel data > using R (through VBA code). I tried out the test code posted in the web > (given below) > > > > Sub ReadTest() > >> rinterface.StartRServer > >> rinterface.RRun "setwd(""c:/work/rcomtest"")" > >> ChDir "c:\work\rcomtest" > >> rinterface.RunRFile "read.R" > >> rinterface.StopRServer > >> *rinterface.getdataframe "mydat", Range("Sheet1!A1")* > >> End Sub you only can stop the server AFTER you have transferred the data to excel. > >> > >> > >> --- read.R > >> > >> setwd("c:/work/rcomtest") > >> mydat<-read.csv("data.txt") > >> > >> > >> --- data.txt > >> > >> xxx1,zzz2 > >> 1,2 > >> 3,4 > >> 5,6 > > > > It gives me an error "Run-time error 13- Type mismatch" and when I try to debug, it stops at line below in the RInterface Module. > > > > nrows = REvalReturn("dim(" & DFname & ")[1]") + 1. > > > > I am using R (2.5.1) and RSrv200.exe. > > > > Thanks in advance. > > > > Regards, > > > > > > > > -Uma > > > > This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this > e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of > the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not > necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained > at http://www.ambaresearch.com/disclaimer > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rcom-l mailing list > Rcom-l@mailman.csd.univie.ac.at > http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l > More information (including a Wiki) at http://rcom.univie.ac.at -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 _______________________________________________ Rcom-l mailing list Rcom-l@mailman.csd.univie.ac.at http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l More information (including a Wiki) at http://rcom.univie.ac.at This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer _______________________________________________ Rcom-l mailing list Rcom-l@mailman.csd.univie.ac.at http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l More information (including a Wiki) at http://rcom.univie.ac.at This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer _______________________________________________ Rcom-l mailing list Rcom-l@mailman.csd.univie.ac.at http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l More information (including a Wiki) at http://rcom.univie.ac.at