One of the reasons I added RunRFile was exactly this problem.

Felipe Carrillo wrote:
> Thanks a lot to all of you for your time, the last two
> options worked. 
> Felipe
> 
> --- Julien Vanwinsberghe <[EMAIL PROTECTED]> wrote:
> 
>> Gary,
>>
>> You're totally right, we have to use 4 backslashes
>> to obtain 2 backslashes
>> in a .NET string.
>> In VBA, you don't need to double the backslashes, so
>> 2 is enough.
>>
>> So Felipe, I think you can try any of these 3
>> solutions:
>>      Call RRun("source(""" &
>> Replace(ThisWorkbook.Path,"\","\\") &
>> "\\temp.r"")")
>> or   RInterface.RunRFile ThisWorkbook.Path & "\temp.r"
>> as said by Yaning
>> or   RRun "source(""" &
>> Replace(ThisWorkbook.Path,"\","/") & "/temp.r"")"
>> as proposed by Erich
>>
>> Regards
>>
>> --
>> Julien Vanwinsberghe
>> Director, Statistical Solutions.
>> Clinbay (Statistical Solution to Drug Development)
>> www.clinbay.com
>>
>> -----Message d'origine-----
>> De : [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] De
>> la part de Gary Prothero
>> Envoyé : lundi 17 décembre 2007 21:44
>> À : 'R (D)COM and RExcel server related issues'
>> Objet : RE: [Rcom-l] Call
>> rinterface.RRun("Source(ThisWorkbook.Path &
>>
>> Julien,
>>
>> I my .net class I use 4 backslashes \\\\ when
>> referencing a directory
>> location. 
>>
>> Gary Prothero
>> ProWorks Corporation
>> [EMAIL PROTECTED]
>> www.proworks.com
>> (541) 752-9885 ext. 1001
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On
>> Behalf Of Felipe
>> Carrillo
>> Sent: Monday, December 17, 2007 12:12 PM
>> To: R (D)COM and RExcel server related issues
>> Subject: Re: [Rcom-l] Call
>> rinterface.RRun("Source(ThisWorkbook.Path &
>>
>> Hi all:
>> I tried double forward and backslashes and nothing
>> seems to work. I looked all over for an example
>> using
>> ThisWorkbook.Path but couldn't find
>> anything.Everybody
>> seems to use a hardcoded path to the R file. I
>> wonder
>> if someone has another suggestion on how to run the
>> R
>> file through VBA. Thanks
>> --- Julien Vanwinsberghe <[EMAIL PROTECTED]> wrote:
>>
>>> Hi,
>>>
>>> In addition, be careful with the "source" R
>>> function, all the folder 
>>> separators '\' characters must be replaced by '\\'
>>> or '/'.
>>>
>>> Regards,
>>>
>>> Julien Vanwinsberghe
>>>
>>> Yaning Zhang a écrit :
>>>> Hi, if you would like to run R script from a
>> file,
>>> maybe you can try 
>>>> Call Rinterface.RunRFile
>>>>
>>>> -----Original Message-----
>>>> From: [EMAIL PROTECTED]
>>>> [mailto:[EMAIL PROTECTED]
>>> On Behalf Of Felipe
>>>> Carrillo
>>>> Sent: Monday, December 17, 2007 3:35 PM
>>>> To: rcom-l@mailman.csd.univie.ac.at
>>>> Subject: Re: [Rcom-l] Call
>>> rinterface.RRun("Source(ThisWorkbook.Path &
>>>> My R script and my workbook reside on my
>> desktop.
>>> When
>>>> I try to run my script through the macro nothing
>>>> happens. the code below seems to be correct
>>> though.
>>>> Call rinterface.RRun("source("""&
>>> ThisWorkbook.Path
>>>> & "\temp.r"")")
>>>> Any ideas anybody?
>>>>
>>>>
>>>> --- Prokaj Vilmos <[EMAIL PROTECTED]> wrote:
>>>>
>>>>   
>>>>> You probably wanted to write
>>>>>
>>>>> Call rinterface.RRun("source("""&
>>> ThisWorkbook.Path
>>>>> & "\temp.r"")")
>>>>>
>>>>> In VBA "" stands for " inside a string
>>>>>
>>>>> Vilmos Prokaj
>>>>>
>>>>>     
> ________________________________________________________________________
>>>> ____________
>>>>   
>>>>>> Never miss a thing.  Make Yahoo your home
>> page. 
>>>>>> http://www.yahoo.com/r/hs
>>>>>>
>> _______________________________________________
>>>>>> 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
>>>>>     
>>>>>>   
>>>>>>       
>>>>> _______________________________________________
>>>>> 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
>>>>>
>>>>>     
>>>>
>>>> Felipe D. Carrillo
>>>>   Fishery Biologist
>>>>   US Fish & Wildlife Service
>>>>   California, USA
>>>>
>>>>
>>>>
>>>>  
>>>>
> ________________________________________________________________________
>>>> ____________
>>>> Be a better friend, newshound, and 
>>>> know-it-all with Yahoo! Mobile.  Try it now.
>>>>
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>>>> _______________________________________________
>>>> 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
>>>> _______________________________________________
>>>> 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
>>>>   
> === message truncated ===>
> _______________________________________________
>> 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
> 
> 
> Felipe D. Carrillo
>   Fishery Biologist
>   US Fish & Wildlife Service
>   California, USA
> 
> 
> 
>       
> ____________________________________________________________________________________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search.  
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> _______________________________________________
> 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

Reply via email to