Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

Re: [R] Help with interfacing C & R

Tim Smith

2007-02-08

Replies:

Hi Oleg,

Thanks !! I did as you said, and it works from the Rterm window now.

My only other question is, that now I have the C code compiled, how do I make 'hello2.r' run from the RGui? I tried to execute the r code from this after I was able to run the code in the Rterm and got the following errors:

> source("tryc/hello2.r")
Error in .C("hello", as.integer(n)) : C symbol name "hello" not in load table

I also tried with putting 'dyn.load("hello")' at the begining of the r code block, but got the following error:

---------------------------------------------------------------------------------------
Error in dyn.load(x, as.logical(local), as.logical(now)) :
    unable to load shared library 'E:/My Documents/work/projects/landmarks/hello':
LoadLibrary failure: The specified module could not be found.
---------------------------------------------------------------------------------------


Thanks again for all your help. I guess I'll try to figure out the RGui error tomorrow.


take care,

Tim


Oleg Sklyar <osklyar@(protected)
>   hello.c hello2.r

It is always advisable not to have spaces in such directories (like the
ones you want to include into a system variable), but fine.

>   E:\My Documents\work\projects\landmarks\tryc>R CMD SHLIB hello.c
>   'R' is not recognized as an internal or external command,
>   operable program or batch file.

Your R is not in the PATH! You need to add it, see also below!

>   E:\My Documents\work\projects\landmarks\tryc>echo %PATH%
>
C:\texmf\miktex\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\P
>   rogram Files\ATI Technologies\ATI Control
>   Panel;E:\PROGRA~1\F-Secure\Ssh;E:\Prog
>   ram Files\ESTsoft\ALZip\;C:\Program
>   Files\QuickTime\QTSystem\;E:\prg_files\tools
>
\bin;E:\prg_files\cygwin\bin;E:\prg_files\cygwin\lib;E:\prg_files\ActivePerl\Act
>
ivePerl\Perl\bin;E:\prg_files\ActivePerl\ActivePerl\Perl\lib;E:\Program
>   Files\ES
>   Tsoft\ALZip\

There are at least 2 mistakes that I see in your PATH above:
- you need to add: E:\prg_files\R\R-2.4.1\bin;
- you need to add path to wherever MinGW\bin is and add it before
cygwin! if you do not have MinGW installed, download and install it.

I guess E:\prg_files\tools\bin are RTools, if so, this is fine. Your own
program must not necessarily be in the PATH

--
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466




---------------------------------
Be a PS3 game guru.

 [[alternative HTML version deleted]]

______________________________________________
R-help@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.