Compiling C and calling it from R. The base R comes with a C compiler if you have version 2.1.3 or later. There are also other C compilers you can use, like XCode, for Mac OSX. It includes a C and C++ compiler, among other tools. Another common one is GCC. There are many free ones for PCs. See for instance https://www.thoughtco.com/list-of-free-c-compilers-958190 . But for most of you, if you download R to your computer, it should be fine. The first step to writing C code is opening a text editor. Write your C code, call it something.c, then compile it, to create an object file called something.so. Then you can load that into R. Hello world. Create a C function to print "Hello world!" and call this function n times in R. In a text editor, create a C file. Say it's called hello.c The file looks like: #include #include /* Start a comment. Continue your comment. */ void hello (int *n) { int i,j; double a2; a2 = 4.5; j = 3; for(i = 0; i < *n; i++) Rprintf("The %d rd integral is %f .\n", j, a2); } PUT THE FILE HELLO.C IN YOUR WORKING R DIRECTORY, OR MAKE YOUR CURRENT R DIRECTORY THE FOLDER CONTAINING HELLO.C. In UNIX, in same directory where hello.c is, type R CMD SHLIB hello.c or, in R, do system("R CMD SHLIB hello.c") In R, in the same directory, do dyn.load("hello.so") hello2 = function(n){ .C("hello",as.integer(n)) } y = hello2(10)