Explore Connect Documentation
Snippets
1
2
3
4
5
6
7
8
9
10
11
12
#include <R.h>
#include <math.h>
void fooC(double* a, double* b, int* n, double* result) {
  int i, j;
  for (i = 0; i < (*n); i++) {
    result[i] = 0;
    for (j = 0; j < (*n); j++)
      result[i] += pow(a[j] + i + 1, b[j]);
  }
}
Press desired key combination and then press ENTER.
1
dyn.load("chapter7/fooC.so")  # load the compiled C code
Press desired key combination and then press ENTER.