Hi,
 
I am hoping some one can help me.  I am learning to use C and would like to learn how to call c code in R.  I have look at 
Writing R Extensions

 

 

and I tried to copy the example on page 38 

 

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

 

 

and I got the error "C" function name not in load table.

 

Do I need to compile the C code first?

Do I need a c copmiler at all?

 

Any suggestions for a begginner?

 

Thanks,

 

Elizabeth Lawson

I 


		
---------------------------------

 Click here to donate to the Hurricane Katrina relief effort. 
	[[alternative HTML version deleted]]


