Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (30 sloc) 333 Bytes

Compile C code

# is gcc there?
Sys.which("gcc")
##            gcc 
## "/usr/bin/gcc"

Does engine = 'c' work?

void square(double *x) {
  *x = *x * *x;
}

Test the square() function:

.C("square", 9)
## [[1]]
## [1] 81
.C("square", 123)
## [[1]]
## [1] 15129