basic functions that call C from R