[R] .C help

From: Elizabeth Lawson <lizzylaws_at_yahoo.com>
Date: Sat 01 Oct 2005 - 04:57:28 EST


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)






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?  


Elizabeth Lawson                 

 Click here to donate to the Hurricane Katrina relief effort.

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Oct 01 05:13:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:34 EST