[R] calling c function from R

Berend Hasselman bhh at xs4all.nl
Tue Nov 27 18:46:25 CET 2012


On 27-11-2012, at 17:21, Li Shangru wrote:

> Hello
> 
> I want to call C function from R. I follow the instruction below using the
> example of foo.c
> http://www.stat.umn.edu/~charlie/rc/
> 
> I saved the foo.c in my work directory. Then I entered the command
> 
> R CMD SHLIB foo.c , I got the following message
> 
> 
> 
> Error: unexpected symbol in "R CMD"
> 
> 
> How did it go wrong? Thanks!

Not how but why?
The message is given by R when  the syntax is wrong.

You didn't do what you were supposed to do according to the instructions.
The command

R CMD SHLIB foo.c 

should be executed outside of R.

Berend




More information about the R-help mailing list