Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Pascal code in R-project?

Tags:

io

r

pascal

I am using R-project to deal with my statistics, but due to the amount of resources needed, R is struggling while pascal would do it way faster. Is there a way to use pascal code in R-project?

like image 276
Andrius Naruševičius Avatar asked Feb 28 '26 01:02

Andrius Naruševičius


1 Answers

If you can compile it to a dll (windows) or a .so (unix) file then you might be able to use the same mechanism as used for C and Fortran. You load the dll/.so with the dyn.load() function and then call it with .C("functionname").

However, this is all very dependent on your operating system, your compiler, and your code.

R helps Fortran and C programmers by providing the SHLIB command. One just does:

R CMD SHLIB foo.f

and gets a foo.so back. Then do dyn.load("foo.so") and you can call the Fortran code with .C("subname",as.integer(1),as.double(pi)) and so on.

Perhaps if you can convert your pascal to C (is there a 'p2c' converter?).

like image 148
Spacedman Avatar answered Mar 01 '26 14:03

Spacedman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!