[R] loading c code in windows ambient

Alessandro Soranzo soranzo at psico.univ.trieste.it
Wed Apr 7 15:55:38 CEST 2004


Dear all,
I'm studing how to include .c code in my .r functions . In the R-exts.pdf
manual I have found the following code. At one point the author write
"called from R by"...
How can I load a .c file on R? ( I am using a xp windows as so.)
Thank you
ale

void convolve(double *a, int *na, double *b, int *nb, double *ab)
{
int i, j, nab = *na + *nb - 1;
for(i = 0; i < nab; i++)
ab[i] = 0.0;
for(i = 0; i < *na; i++)
for(j = 0; j < *nb; j++)
ab[i + j] += a[i] * b[j];
}
#called from R by ??????????????????????
conv <- function(a, b)
.C("convolve",
as.double(a),
as.integer(length(a)),
as.double(b),
as.integer(length(b)),
ab = double(length(a) + length(b) - 1))$ab


More information about the R-help mailing list