Index of /examples/r/examples/call_c

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory   -  
[TXT]R_call_C.R 2017-11-19 12:31 109  
[TXT]c_lib.c 2017-11-19 12:32 682  
[   ]c_lib.o 2017-11-19 12:32 7.5K 

RCS Example of R script call C function

Compile C code:
[scc1 ~] module load R/4.0.2
[scc1 ~] R CMD SHLIB  c_lib.c -o

From R script load the dynamic library:
Execute C function within R script :
result <- .Call("cfunction", a=21.7, b=3.14)

For help email

Research Computing Services:

Note: RCS example programs are provided "as is" without any warranty of any kind. The user assumes the intire risk of quality, performance, and repair of any defect. You are welcome to copy and modify any of the given examples for your own use.