It's possible to build a library that gives access to some R functions, without having to install the whole of R. The package rclmath is a wrapper that gives access to some of these functions (definitions for the "utility" functions are included but not exported, the "constants" are included in a separate file but they're read as double-floats anyway and the extra precision is lost).
Beta, Choose, Gamma (and related), and Bessel functions are available, and also a random number generator that can produce different distributions (also density, quantile, and cumulative distribution functions).
| AllegroCL 8.0 | CLISP 2.41 | CMUCL 19d | LispWorks 5.0 | OpenMCL 1.1 | SBCL 1.0 | |
|---|---|---|---|---|---|---|
| Linux/i386 | OK | OK | OK | OK | NA | OK |
| MacOSX/i386 | OK | NO FFI | NA | OK | NA | OK |
| MacOSX/PPC | OK | OK | OK | OK | OK | OK |
The results above correspond to FedoraCore6 running on a PIV, and Tiger running on a G4 and a CoreDuo (using R 2.5.0/2.5.1). It's untested on Windows (I didn't find a Rmath.dll anywhere, and it's not easy to produce it), please let me know if it does (or doesn't) work.
CL-USER> (rmath:gamma 3.2) 2.4239655953848476d0 CL-USER> (rmath:bessel :i 2 3) 0.21273995923985264d0 CL-USER> (rmath:rng-seed) (1234 5678) CL-USER> (rmath:r-weibull 2 .3) 0.4531797452688073d0 CL-USER> (rmath:r-weibull 2 .3) 0.11911193157047341d0 CL-USER> (setf (rmath:rng-seed) '(1234 5678)) (1234 5678) CL-USER> (rmath:r-weibull 2 .3) 0.4531797452688073d0